]> granicus.if.org Git - clang/commitdiff
Revert the flags change for now, I have a better idea for this.
authorAnders Carlsson <andersca@mac.com>
Thu, 27 Aug 2009 17:14:02 +0000 (17:14 +0000)
committerAnders Carlsson <andersca@mac.com>
Thu, 27 Aug 2009 17:14:02 +0000 (17:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80255 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/Sema.h
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaOverload.cpp

index 8a8e9456ca22c99fabe26c3d6bb06229a603f696..a5a0723256f88655bbd01c7bf073552e84db7411 100644 (file)
@@ -721,17 +721,13 @@ public:
   bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old);
 
   /// C++ Overloading.
-  enum OverloadResolutionFlags {
-    ORF_None = 0x0,
-    ORF_SuppressUserConversions = 0x1,
-    ORF_AllowExplicit = 0x2,
-    ORF_ForceRValue = 0x4
-  };
-  
   bool IsOverload(FunctionDecl *New, Decl* OldD, 
                   OverloadedFunctionDecl::function_iterator &MatchedDecl);
   ImplicitConversionSequence 
-  TryImplicitConversion(Expr* From, QualType ToType, unsigned Flags = ORF_None);
+  TryImplicitConversion(Expr* From, QualType ToType,
+                        bool SuppressUserConversions = false,
+                        bool AllowExplicit = false,
+                        bool ForceRValue = false);
   bool IsStandardConversion(Expr *From, QualType ToType, 
                             StandardConversionSequence& SCS);
   bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
index be45a2d56d9cf6aac3c9f2dbb7893e72186e0b8e..c5eda94b6a66e89bbd671ec16d57e5be0d4622fc 100644 (file)
@@ -3144,10 +3144,7 @@ Sema::CheckReferenceInit(Expr *&Init, QualType DeclType,
     //   the argument expression. Any difference in top-level
     //   cv-qualification is subsumed by the initialization itself
     //   and does not constitute a conversion.
-    *ICS = TryImplicitConversion(Init, T1, 
-                                 SuppressUserConversions ? 
-                                 ORF_SuppressUserConversions : 
-                                 ORF_None);
+    *ICS = TryImplicitConversion(Init, T1, SuppressUserConversions);
     // Of course, that's still a reference binding.
     if (ICS->ConversionKind == ImplicitConversionSequence::StandardConversion) {
       ICS->Standard.ReferenceBinding = true;
index 1d05008cbe903dc3ac14ba07bf2baa95bb697279..85924948da799dac676061760882c191d6bb9754 100644 (file)
@@ -881,19 +881,14 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
                                 const char *Flavor, bool AllowExplicit,
                                 bool Elidable)
 {
-  unsigned Flags = ORF_None;
-  if (AllowExplicit)
-    Flags |= ORF_AllowExplicit;
-  
   ImplicitConversionSequence ICS;
   ICS.ConversionKind = ImplicitConversionSequence::BadConversion;
   if (Elidable && getLangOptions().CPlusPlus0x) {
-    Flags |= ORF_ForceRValue;
-
-    ICS = TryImplicitConversion(From, ToType, Flags);
+    ICS = TryImplicitConversion(From, ToType, /*SuppressUserConversions*/false,
+                                AllowExplicit, /*ForceRValue*/true);
   }
   if (ICS.ConversionKind == ImplicitConversionSequence::BadConversion) {
-    ICS = TryImplicitConversion(From, ToType, Flags);
+    ICS = TryImplicitConversion(From, ToType, false, AllowExplicit);
   }
   return PerformImplicitConversion(From, ToType, ICS, Flavor);
 }
index 2c8c7317975e7e6ebf85154e13a631a486421793..dde5c287236430fd7bf22c85146d7958e023d990 100644 (file)
@@ -408,11 +408,10 @@ Sema::IsOverload(FunctionDecl *New, Decl* OldD,
 /// If @p ForceRValue, then overloading is performed as if From was an rvalue,
 /// no matter its actual lvalueness.
 ImplicitConversionSequence
-Sema::TryImplicitConversion(Expr* From, QualType ToType, unsigned Flags) {
-  bool SuppressUserConversions = Flags & ORF_SuppressUserConversions;
-  bool AllowExplicit = Flags & ORF_AllowExplicit;
-  bool ForceRValue = Flags & ORF_ForceRValue;
-  
+Sema::TryImplicitConversion(Expr* From, QualType ToType,
+                            bool SuppressUserConversions,
+                            bool AllowExplicit, bool ForceRValue)
+{
   ImplicitConversionSequence ICS;
   if (IsStandardConversion(From, ToType, ICS.Standard))
     ICS.ConversionKind = ImplicitConversionSequence::StandardConversion;
@@ -1930,11 +1929,8 @@ Sema::TryCopyInitialization(Expr *From, QualType ToType,
                        /*AllowExplicit=*/false, ForceRValue);
     return ICS;
   } else {
-    unsigned Flags = ORF_None;
-    if (SuppressUserConversions) Flags |= ORF_SuppressUserConversions;
-    if (ForceRValue) Flags |= ORF_ForceRValue;
-    
-    return TryImplicitConversion(From, ToType, Flags);
+    return TryImplicitConversion(From, ToType, SuppressUserConversions,
+                                 ForceRValue);
   }
 }
 
@@ -2068,7 +2064,7 @@ Sema::PerformObjectArgumentInitialization(Expr *&From, CXXMethodDecl *Method) {
 /// TryContextuallyConvertToBool - Attempt to contextually convert the
 /// expression From to bool (C++0x [conv]p3).
 ImplicitConversionSequence Sema::TryContextuallyConvertToBool(Expr *From) {
-  return TryImplicitConversion(From, Context.BoolTy, ORF_AllowExplicit);
+  return TryImplicitConversion(From, Context.BoolTy, false, true);
 }
 
 /// PerformContextuallyConvertToBool - Perform a contextual conversion