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

Fariborz Jahanian fjahanian at apple.com
Fri Sep 11 11:46:23 PDT 2009


Author: fjahanian
Date: Fri Sep 11 13:46:22 2009
New Revision: 81549

URL: http://llvm.org/viewvc/llvm-project?rev=81549&view=rev
Log:
Undid my yesterday patch which is not needed with an upcoming patch.

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=81549&r1=81548&r2=81549&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Fri Sep 11 13:46:22 2009
@@ -858,9 +858,6 @@
   void AddTemplateConversionCandidate(FunctionTemplateDecl *FunctionTemplate,
                                       Expr *From, QualType ToType,
                                       OverloadCandidateSet &CandidateSet);
-  void AddAllConversionCandidate(CXXRecordDecl *ClassDecl, Expr *From, 
-                                 QualType ToType, bool AllowExplicit,
-                                 OverloadCandidateSet &CandidateSet);
   void AddSurrogateCandidate(CXXConversionDecl *Conversion,
                              const FunctionProtoType *Proto,
                              Expr *Object, Expr **Args, unsigned NumArgs,

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Sep 11 13:46:22 2009
@@ -1331,52 +1331,6 @@
     Function = cast<T>(Orig);
 }
 
-void
-Sema::AddAllConversionCandidate(CXXRecordDecl *ClassDecl, Expr *From, 
-                                QualType ToType, bool AllowExplicit,
-                                OverloadCandidateSet &CandidateSet) {
-  for (CXXRecordDecl::base_class_iterator VBase = ClassDecl->vbases_begin(),
-       E = ClassDecl->vbases_end(); VBase != E; ++VBase) {
-    CXXRecordDecl *BaseClassDecl
-      = cast<CXXRecordDecl>(VBase->getType()->getAs<RecordType>()->getDecl());
-    AddAllConversionCandidate(BaseClassDecl, From, ToType, AllowExplicit,
-                              CandidateSet);
-  }
-  for (CXXRecordDecl::base_class_iterator Base =
-        ClassDecl->bases_begin(),
-        E = ClassDecl->bases_end(); Base != E; ++Base) {
-    if (Base->isVirtual())
-      continue;
-    CXXRecordDecl *BaseClassDecl
-      = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
-    AddAllConversionCandidate(BaseClassDecl, From, ToType, AllowExplicit,
-                              CandidateSet);
-  }
-  
-  OverloadedFunctionDecl *Conversions 
-    = ClassDecl->getConversionFunctions();
-
-  for (OverloadedFunctionDecl::function_iterator Func 
-        = Conversions->function_begin();
-       Func != Conversions->function_end(); ++Func) {
-    CXXConversionDecl *Conv;
-    FunctionTemplateDecl *ConvTemplate;
-    GetFunctionAndTemplate(*Func, Conv, ConvTemplate);
-    if (ConvTemplate)
-      Conv = dyn_cast<CXXConversionDecl>(ConvTemplate->getTemplatedDecl());
-    else 
-      Conv = dyn_cast<CXXConversionDecl>(*Func);
-    
-    if (AllowExplicit || !Conv->isExplicit()) {
-      if (ConvTemplate)
-        AddTemplateConversionCandidate(ConvTemplate, From, ToType, 
-                                       CandidateSet);
-      else
-        AddConversionCandidate(Conv, From, ToType, CandidateSet);
-    }
-  }  
-}
-
 /// Determines whether there is a user-defined conversion sequence
 /// (C++ [over.ics.user]) that converts expression From to the type
 /// ToType. If such a conversion exists, User will contain the
@@ -1451,10 +1405,31 @@
   } else if (const RecordType *FromRecordType
                = From->getType()->getAs<RecordType>()) {
     if (CXXRecordDecl *FromRecordDecl
-          = dyn_cast<CXXRecordDecl>(FromRecordType->getDecl())) 
-    // Add all of the conversion functions as candidates.
-    AddAllConversionCandidate(FromRecordDecl, From, ToType, AllowExplicit,
-                              CandidateSet);
+         = dyn_cast<CXXRecordDecl>(FromRecordType->getDecl())) {
+      // Add all of the conversion functions as candidates.
+      // FIXME: Look for conversions in base classes!
+      OverloadedFunctionDecl *Conversions
+        = FromRecordDecl->getConversionFunctions();
+      for (OverloadedFunctionDecl::function_iterator Func
+             = Conversions->function_begin();
+           Func != Conversions->function_end(); ++Func) {
+        CXXConversionDecl *Conv;
+        FunctionTemplateDecl *ConvTemplate;
+        GetFunctionAndTemplate(*Func, Conv, ConvTemplate);
+        if (ConvTemplate)
+          Conv = dyn_cast<CXXConversionDecl>(ConvTemplate->getTemplatedDecl());
+        else
+          Conv = dyn_cast<CXXConversionDecl>(*Func);
+
+        if (AllowExplicit || !Conv->isExplicit()) {
+          if (ConvTemplate)
+            AddTemplateConversionCandidate(ConvTemplate, From, ToType,
+                                           CandidateSet);
+          else
+            AddConversionCandidate(Conv, From, ToType, CandidateSet);
+        }
+      }
+    }
   }
 
   OverloadCandidateSet::iterator Best;





More information about the cfe-commits mailing list