[cfe-commits] r80368 - in /cfe/trunk/lib/Sema: Sema.h SemaCXXCast.cpp SemaDeclCXX.cpp SemaExprCXX.cpp SemaOverload.cpp

Anders Carlsson andersca at mac.com
Fri Aug 28 08:33:32 PDT 2009


Author: andersca
Date: Fri Aug 28 10:33:32 2009
New Revision: 80368

URL: http://llvm.org/viewvc/llvm-project?rev=80368&view=rev
Log:
Pass InOverloadResolution all the way down to IsPointerConversion.

Modified:
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaCXXCast.cpp
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/lib/Sema/SemaExprCXX.cpp
    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=80368&r1=80367&r2=80368&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Fri Aug 28 10:33:32 2009
@@ -727,13 +727,16 @@
   TryImplicitConversion(Expr* From, QualType ToType,
                         bool SuppressUserConversions,
                         bool AllowExplicit,
-                        bool ForceRValue);
-  bool IsStandardConversion(Expr *From, QualType ToType, 
+                        bool ForceRValue,
+                        bool InOverloadResolution);
+  bool IsStandardConversion(Expr *From, QualType ToType,
+                            bool InOverloadResolution,
                             StandardConversionSequence& SCS);
   bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
   bool IsFloatingPointPromotion(QualType FromType, QualType ToType);
   bool IsComplexPromotion(QualType FromType, QualType ToType);
   bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
+                           bool InOverloadResolution,
                            QualType& ConvertedType, bool &IncompatibleObjC);
   bool isObjCPointerConversion(QualType FromType, QualType ToType,
                                QualType& ConvertedType, bool &IncompatibleObjC);

Modified: cfe/trunk/lib/Sema/SemaCXXCast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXCast.cpp?rev=80368&r1=80367&r2=80368&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXCast.cpp Fri Aug 28 10:33:32 2009
@@ -785,7 +785,8 @@
     Self.TryImplicitConversion(SrcExpr, DestType,
                                /*SuppressUserConversions=*/false,
                                /*AllowExplicit=*/false,
-                               /*ForceRValue=*/false);
+                               /*ForceRValue=*/false,
+                               /*InOverloadResolution=*/false);
   
   if (ICS.ConversionKind  == ImplicitConversionSequence::UserDefinedConversion)
     if (CXXMethodDecl *MD = 

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=80368&r1=80367&r2=80368&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Aug 28 10:33:32 2009
@@ -3213,7 +3213,8 @@
     //   and does not constitute a conversion.
     *ICS = TryImplicitConversion(Init, T1, SuppressUserConversions,
                                  /*AllowExplicit=*/false,
-                                 /*ForceRValue=*/false);
+                                 /*ForceRValue=*/false,
+                                 /*InOverloadResolution=*/false);
     
     // Of course, that's still a reference binding.
     if (ICS->ConversionKind == ImplicitConversionSequence::StandardConversion) {

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=80368&r1=80367&r2=80368&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Aug 28 10:33:32 2009
@@ -890,13 +890,15 @@
     ICS = TryImplicitConversion(From, ToType, 
                                 /*SuppressUserConversions=*/false,
                                 AllowExplicit, 
-                                /*ForceRValue=*/true);
+                                /*ForceRValue=*/true,
+                                /*InOverloadResolution=*/false);
   }
   if (ICS.ConversionKind == ImplicitConversionSequence::BadConversion) {
     ICS = TryImplicitConversion(From, ToType, 
                                 /*SuppressUserConversions=*/false,
                                 AllowExplicit,
-                                /*ForceRValue=*/false);
+                                /*ForceRValue=*/false,
+                                /*InOverloadResolution=*/false);
   }
   return PerformImplicitConversion(From, ToType, ICS, Flavor);
 }
@@ -1259,7 +1261,8 @@
     ICS = Self.TryImplicitConversion(From, TTy,
                                      /*SuppressUserConversions=*/false,
                                      /*AllowExplicit=*/false,
-                                     /*ForceRValue=*/false);
+                                     /*ForceRValue=*/false,
+                                     /*InOverloadResolution=*/false);
   }
   return false;
 }
@@ -1652,12 +1655,14 @@
     TryImplicitConversion(E1, Composite1,
                           /*SuppressUserConversions=*/false,
                           /*AllowExplicit=*/false,
-                          /*ForceRValue=*/false);
+                          /*ForceRValue=*/false,
+                          /*InOverloadResolution=*/false);
   ImplicitConversionSequence E2ToC1 = 
     TryImplicitConversion(E2, Composite1,
                           /*SuppressUserConversions=*/false,
                           /*AllowExplicit=*/false,
-                          /*ForceRValue=*/false);
+                          /*ForceRValue=*/false,
+                          /*InOverloadResolution=*/false);
   
   ImplicitConversionSequence E1ToC2, E2ToC2;
   E1ToC2.ConversionKind = ImplicitConversionSequence::BadConversion;
@@ -1667,11 +1672,13 @@
     E1ToC2 = TryImplicitConversion(E1, Composite2,
                                    /*SuppressUserConversions=*/false,
                                    /*AllowExplicit=*/false,
-                                   /*ForceRValue=*/false);
+                                   /*ForceRValue=*/false,
+                                   /*InOverloadResolution=*/false);
     E2ToC2 = TryImplicitConversion(E2, Composite2,
                                    /*SuppressUserConversions=*/false,
                                    /*AllowExplicit=*/false,
-                                   /*ForceRValue=*/false);
+                                   /*ForceRValue=*/false,
+                                   /*InOverloadResolution=*/false);
   }
 
   bool ToC1Viable = E1ToC1.ConversionKind !=

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=80368&r1=80367&r2=80368&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Aug 28 10:33:32 2009
@@ -410,10 +410,11 @@
 ImplicitConversionSequence
 Sema::TryImplicitConversion(Expr* From, QualType ToType,
                             bool SuppressUserConversions,
-                            bool AllowExplicit, bool ForceRValue)
+                            bool AllowExplicit, bool ForceRValue,
+                            bool InOverloadResolution)
 {
   ImplicitConversionSequence ICS;
-  if (IsStandardConversion(From, ToType, ICS.Standard))
+  if (IsStandardConversion(From, ToType, InOverloadResolution, ICS.Standard))
     ICS.ConversionKind = ImplicitConversionSequence::StandardConversion;
   else if (getLangOptions().CPlusPlus &&
            IsUserDefinedConversion(From, ToType, ICS.UserDefined, 
@@ -471,6 +472,7 @@
 /// routine will return false and the value of SCS is unspecified.
 bool 
 Sema::IsStandardConversion(Expr* From, QualType ToType, 
+                           bool InOverloadResolution,
                            StandardConversionSequence &SCS)
 {
   QualType FromType = From->getType();
@@ -621,8 +623,8 @@
     // Complex-real conversions (C99 6.3.1.7)
     SCS.Second = ICK_Complex_Real;
     FromType = ToType.getUnqualifiedType();
-  } else if (IsPointerConversion(From, FromType, ToType, FromType, 
-                                 IncompatibleObjC)) {
+  } else if (IsPointerConversion(From, FromType, ToType, InOverloadResolution,
+                                 FromType, IncompatibleObjC)) {
     // Pointer conversions (C++ 4.10).
     SCS.Second = ICK_Pointer_Conversion;
     SCS.IncompatibleObjC = IncompatibleObjC;
@@ -885,6 +887,7 @@
 /// set if the conversion is an allowed Objective-C conversion that
 /// should result in a warning.
 bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
+                               bool InOverloadResolution,
                                QualType& ConvertedType,
                                bool &IncompatibleObjC)
 {
@@ -1936,7 +1939,8 @@
     return TryImplicitConversion(From, ToType, 
                                  SuppressUserConversions,
                                  /*AllowExplicit=*/false,
-                                 ForceRValue);
+                                 ForceRValue,
+                                 InOverloadResolution);
   }
 }
 
@@ -2077,7 +2081,8 @@
                                // FIXME: Are these flags correct?
                                /*SuppressUserConversions=*/false,
                                /*AllowExplicit=*/true, 
-                               /*ForceRValue=*/false);
+                               /*ForceRValue=*/false,
+                               /*InOverloadResolution=*/false);
 }
 
 /// PerformContextuallyConvertToBool - Perform a contextual conversion
@@ -2291,7 +2296,7 @@
       Candidate.Conversions[ArgIdx + 1] 
         = TryCopyInitialization(Args[ArgIdx], ParamType, 
                                 SuppressUserConversions, ForceRValue,
-                                /*InOverloadResolution=*/false);
+                                /*InOverloadResolution=*/true);
       if (Candidate.Conversions[ArgIdx + 1].ConversionKind 
             == ImplicitConversionSequence::BadConversion) {
         Candidate.Viable = false;





More information about the cfe-commits mailing list