[cfe-commits] r101497 - in /cfe/trunk/lib/Sema: Sema.h SemaOverload.cpp

Douglas Gregor dgregor at apple.com
Fri Apr 16 10:51:22 PDT 2010


Author: dgregor
Date: Fri Apr 16 12:51:22 2010
New Revision: 101497

URL: http://llvm.org/viewvc/llvm-project?rev=101497&view=rev
Log:
Move Sema::TryCopyInitialization into a static function in
SemaOverload.cpp; no functionality change.

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

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=101497&r1=101496&r2=101497&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Fri Apr 16 12:51:22 2010
@@ -1113,11 +1113,6 @@
   CompareDerivedToBaseConversions(const StandardConversionSequence& SCS1,
                                   const StandardConversionSequence& SCS2);
 
-  ImplicitConversionSequence
-  TryCopyInitialization(Expr* From, QualType ToType,
-                        bool SuppressUserConversions, bool ForceRValue,
-                        bool InOverloadResolution);
-  
   OwningExprResult PerformCopyInitialization(const InitializedEntity &Entity,
                                              SourceLocation EqualLoc,
                                              OwningExprResult Init);

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=101497&r1=101496&r2=101497&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Apr 16 12:51:22 2010
@@ -2504,21 +2504,21 @@
 /// a parameter of this type). If @p SuppressUserConversions, then we
 /// do not permit any user-defined conversion sequences. If @p ForceRValue,
 /// then we treat @p From as an rvalue, even if it is an lvalue.
-ImplicitConversionSequence
-Sema::TryCopyInitialization(Expr *From, QualType ToType,
-                            bool SuppressUserConversions, bool ForceRValue,
-                            bool InOverloadResolution) {
+static ImplicitConversionSequence
+TryCopyInitialization(Sema &S, Expr *From, QualType ToType,
+                      bool SuppressUserConversions, bool ForceRValue,
+                      bool InOverloadResolution) {
   if (ToType->isReferenceType())
-    return TryReferenceInit(*this, From, ToType,
+    return TryReferenceInit(S, From, ToType,
                             /*FIXME:*/From->getLocStart(),
                             SuppressUserConversions,
                             /*AllowExplicit=*/false);
 
-  return TryImplicitConversion(From, ToType,
-                               SuppressUserConversions,
-                               /*AllowExplicit=*/false,
-                               ForceRValue,
-                               InOverloadResolution);
+  return S.TryImplicitConversion(From, ToType,
+                                 SuppressUserConversions,
+                                 /*AllowExplicit=*/false,
+                                 ForceRValue,
+                                 InOverloadResolution);
 }
 
 /// TryObjectArgumentInitialization - Try to initialize the object
@@ -2758,7 +2758,7 @@
       // parameter of F.
       QualType ParamType = Proto->getArgType(ArgIdx);
       Candidate.Conversions[ArgIdx]
-        = TryCopyInitialization(Args[ArgIdx], ParamType,
+        = TryCopyInitialization(*this, Args[ArgIdx], ParamType,
                                 SuppressUserConversions, 
                                 /*ForceRValue=*/false,
                                 /*InOverloadResolution=*/true);
@@ -2925,7 +2925,7 @@
       // parameter of F.
       QualType ParamType = Proto->getArgType(ArgIdx);
       Candidate.Conversions[ArgIdx + 1]
-        = TryCopyInitialization(Args[ArgIdx], ParamType,
+        = TryCopyInitialization(*this, Args[ArgIdx], ParamType,
                                 SuppressUserConversions, 
                                 /*ForceRValue=*/false,
                                 /*InOverloadResolution=*/true);
@@ -3121,7 +3121,7 @@
                 Conversion->getConversionType().getNonReferenceType(),
                 From->getLocStart());
   ImplicitConversionSequence ICS =
-    TryCopyInitialization(&Call, ToType,
+    TryCopyInitialization(*this, &Call, ToType,
                           /*SuppressUserConversions=*/true,
                           /*ForceRValue=*/false,
                           /*InOverloadResolution=*/false);
@@ -3269,7 +3269,7 @@
       // parameter of F.
       QualType ParamType = Proto->getArgType(ArgIdx);
       Candidate.Conversions[ArgIdx + 1]
-        = TryCopyInitialization(Args[ArgIdx], ParamType,
+        = TryCopyInitialization(*this, Args[ArgIdx], ParamType,
                                 /*SuppressUserConversions=*/false,
                                 /*ForceRValue=*/false,
                                 /*InOverloadResolution=*/false);
@@ -3413,7 +3413,7 @@
       Candidate.Conversions[ArgIdx] = TryContextuallyConvertToBool(Args[ArgIdx]);
     } else {
       Candidate.Conversions[ArgIdx]
-        = TryCopyInitialization(Args[ArgIdx], ParamTys[ArgIdx],
+        = TryCopyInitialization(*this, Args[ArgIdx], ParamTys[ArgIdx],
                                 ArgIdx == 0 && IsAssignmentOperator,
                                 /*ForceRValue=*/false,
                                 /*InOverloadResolution=*/false);
@@ -5169,11 +5169,11 @@
     assert(ConvCount <= 3);
     for (; ConvIdx != ConvCount; ++ConvIdx)
       Cand->Conversions[ConvIdx]
-        = S.TryCopyInitialization(Args[ConvIdx],
-                                  Cand->BuiltinTypes.ParamTypes[ConvIdx],
-                                  SuppressUserConversions, 
-                                  /*ForceRValue=*/false,
-                                  /*InOverloadResolution*/ true);
+        = TryCopyInitialization(S, Args[ConvIdx],
+                                Cand->BuiltinTypes.ParamTypes[ConvIdx],
+                                SuppressUserConversions, 
+                                /*ForceRValue=*/false,
+                                /*InOverloadResolution*/ true);
     return;
   }
 
@@ -5182,10 +5182,10 @@
   for (; ConvIdx != ConvCount; ++ConvIdx, ++ArgIdx) {
     if (ArgIdx < NumArgsInProto)
       Cand->Conversions[ConvIdx]
-        = S.TryCopyInitialization(Args[ArgIdx], Proto->getArgType(ArgIdx),
-                                  SuppressUserConversions, 
-                                  /*ForceRValue=*/false,
-                                  /*InOverloadResolution=*/true);
+        = TryCopyInitialization(S, Args[ArgIdx], Proto->getArgType(ArgIdx),
+                                SuppressUserConversions, 
+                                /*ForceRValue=*/false,
+                                /*InOverloadResolution=*/true);
     else
       Cand->Conversions[ConvIdx].setEllipsis();
   }





More information about the cfe-commits mailing list