"Incremental" progress on using expressions, by which I mean totally ripping
into pretty much everything about overload resolution in order to wean
BuildDeclarationNameExpr off LookupResult::getAsSingleDecl().  Replace  
UnresolvedFunctionNameExpr with UnresolvedLookupExpr, which generalizes the
idea of a non-member lookup that we haven't totally resolved yet, whether by
overloading, argument-dependent lookup, or (eventually) the presence of   
a function template in the lookup results.  

Incidentally fixes a problem with argument-dependent lookup where we were 
still performing ADL even when the lookup results contained something from
a block scope.  

Incidentally improves a diagnostic when using an ObjC ivar from a class method.
This just fell out from rewriting BuildDeclarationNameExpr's interaction with
lookup, and I'm too apathetic to break it out.

The only remaining uses of OverloadedFunctionDecl that I know of are in
TemplateName and MemberExpr.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89544 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 45870a1..95a5743 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -2601,16 +2601,8 @@
     if (FunctionTemplateDecl *ConversionTemplate
           = Conversion->getDescribedFunctionTemplate())
       ExpectedPrevDecl = ConversionTemplate->getPreviousDeclaration();
-    OverloadedFunctionDecl *Conversions = ClassDecl->getConversionFunctions();
-    for (OverloadedFunctionDecl::function_iterator
-           Conv = Conversions->function_begin(),
-           ConvEnd = Conversions->function_end();
-         Conv != ConvEnd; ++Conv) {
-      if (*Conv == ExpectedPrevDecl) {
-        *Conv = Conversion;
-        return DeclPtrTy::make(Conversion);
-      }
-    }
+    if (ClassDecl->replaceConversion(ExpectedPrevDecl, Conversion))
+      return DeclPtrTy::make(Conversion);
     assert(Conversion->isInvalidDecl() && "Conversion should not get here.");
   } else if (FunctionTemplateDecl *ConversionTemplate
                = Conversion->getDescribedFunctionTemplate())
@@ -3895,18 +3887,17 @@
       = dyn_cast<CXXRecordDecl>(T2->getAs<RecordType>()->getDecl());
 
     OverloadCandidateSet CandidateSet;
-    OverloadedFunctionDecl *Conversions
+    const UnresolvedSet *Conversions
       = T2RecordDecl->getVisibleConversionFunctions();
-    for (OverloadedFunctionDecl::function_iterator Func
-           = Conversions->function_begin();
-         Func != Conversions->function_end(); ++Func) {
+    for (UnresolvedSet::iterator I = Conversions->begin(),
+           E = Conversions->end(); I != E; ++I) {
       FunctionTemplateDecl *ConvTemplate
-        = dyn_cast<FunctionTemplateDecl>(*Func);
+        = dyn_cast<FunctionTemplateDecl>(*I);
       CXXConversionDecl *Conv;
       if (ConvTemplate)
         Conv = cast<CXXConversionDecl>(ConvTemplate->getTemplatedDecl());
       else
-        Conv = cast<CXXConversionDecl>(*Func);
+        Conv = cast<CXXConversionDecl>(*I);
       
       // If the conversion function doesn't return a reference type,
       // it can't be considered for this conversion.