[cfe-commits] r101496 - in /cfe/trunk/lib/Sema: SemaInit.cpp SemaOverload.cpp

Douglas Gregor dgregor at apple.com
Fri Apr 16 10:45:54 PDT 2010


Author: dgregor
Date: Fri Apr 16 12:45:54 2010
New Revision: 101496

URL: http://llvm.org/viewvc/llvm-project?rev=101496&view=rev
Log:
Eliminate ForceRValue parameters from reference binding. Did I mention
that we aren't using ForceRValue any more? 

Modified:
    cfe/trunk/lib/Sema/SemaInit.cpp
    cfe/trunk/lib/Sema/SemaOverload.cpp

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=101496&r1=101495&r2=101496&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Fri Apr 16 12:45:54 2010
@@ -2391,15 +2391,11 @@
     T2 = cv2T2.getUnqualifiedType();
   }
   
-  // FIXME: Rvalue references
-  bool ForceRValue = false;
-  
   // Compute some basic properties of the types and the initializer.
   bool isLValueRef = DestType->isLValueReferenceType();
   bool isRValueRef = !isLValueRef;
   bool DerivedToBase = false;
-  Expr::isLvalueResult InitLvalue = ForceRValue ? Expr::LV_InvalidExpression :
-                                    Initializer->isLvalue(S.Context);
+  Expr::isLvalueResult InitLvalue = Initializer->isLvalue(S.Context);
   Sema::ReferenceCompareResult RefRelationship
     = S.CompareReferenceRelationship(DeclLoc, cv1T1, cv2T2, DerivedToBase);
   

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=101496&r1=101495&r2=101496&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Apr 16 12:45:54 2010
@@ -2241,7 +2241,7 @@
 TryReferenceInit(Sema &S, Expr *&Init, QualType DeclType,
                  SourceLocation DeclLoc,
                  bool SuppressUserConversions,
-                 bool AllowExplicit, bool ForceRValue) {
+                 bool AllowExplicit) {
   assert(DeclType->isReferenceType() && "Reference init needs a reference");
 
   // Most paths end in a failed conversion.
@@ -2264,8 +2264,7 @@
   // Compute some basic properties of the types and the initializer.
   bool isRValRef = DeclType->isRValueReferenceType();
   bool DerivedToBase = false;
-  Expr::isLvalueResult InitLvalue = ForceRValue ? Expr::LV_InvalidExpression :
-                                                  Init->isLvalue(S.Context);
+  Expr::isLvalueResult InitLvalue = Init->isLvalue(S.Context);
   Sema::ReferenceCompareResult RefRelationship
     = S.CompareReferenceRelationship(DeclLoc, T1, T2, DerivedToBase);
 
@@ -2513,8 +2512,7 @@
     return TryReferenceInit(*this, From, ToType,
                             /*FIXME:*/From->getLocStart(),
                             SuppressUserConversions,
-                            /*AllowExplicit=*/false,
-                            ForceRValue);
+                            /*AllowExplicit=*/false);
 
   return TryImplicitConversion(From, ToType,
                                SuppressUserConversions,
@@ -5147,10 +5145,9 @@
   assert(!Cand->Conversions[ConvIdx].isInitialized() &&
          "remaining conversion is initialized?");
 
-  // FIXME: these should probably be preserved from the overload
+  // FIXME: this should probably be preserved from the overload
   // operation somehow.
   bool SuppressUserConversions = false;
-  bool ForceRValue = false;
 
   const FunctionProtoType* Proto;
   unsigned ArgIdx = ConvIdx;
@@ -5174,7 +5171,8 @@
       Cand->Conversions[ConvIdx]
         = S.TryCopyInitialization(Args[ConvIdx],
                                   Cand->BuiltinTypes.ParamTypes[ConvIdx],
-                                  SuppressUserConversions, ForceRValue,
+                                  SuppressUserConversions, 
+                                  /*ForceRValue=*/false,
                                   /*InOverloadResolution*/ true);
     return;
   }
@@ -5185,7 +5183,8 @@
     if (ArgIdx < NumArgsInProto)
       Cand->Conversions[ConvIdx]
         = S.TryCopyInitialization(Args[ArgIdx], Proto->getArgType(ArgIdx),
-                                  SuppressUserConversions, ForceRValue,
+                                  SuppressUserConversions, 
+                                  /*ForceRValue=*/false,
                                   /*InOverloadResolution=*/true);
     else
       Cand->Conversions[ConvIdx].setEllipsis();





More information about the cfe-commits mailing list