r90313, in which OverloadedFunctionDecl is removed and never spoken of again.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90313 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index 2dcd80b..f276faf 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -190,7 +190,6 @@
     case CXXConstructor:
     case CXXDestructor:
     case CXXConversion:
-    case OverloadedFunction:
     case Typedef:
     case EnumConstant:
     case Var:
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index 4001988..d850e4f 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -797,64 +797,6 @@
   return new (C) CXXConversionDecl(RD, L, N, T, DInfo, isInline, isExplicit);
 }
 
-OverloadedFunctionDecl *
-OverloadedFunctionDecl::Create(ASTContext &C, DeclContext *DC,
-                               DeclarationName N) {
-  return new (C) OverloadedFunctionDecl(DC, N);
-}
-
-OverloadIterator::OverloadIterator(NamedDecl *ND) : D(0) {
-  if (!ND)
-    return;
-
-  if (isa<FunctionDecl>(ND) || isa<FunctionTemplateDecl>(ND))
-    D = ND;
-  else if (OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(ND)) {
-    if (Ovl->size() != 0) {
-      D = ND;
-      Iter = Ovl->function_begin();
-    }
-  }
-}
-
-void OverloadedFunctionDecl::addOverload(AnyFunctionDecl F) {
-  Functions.push_back(F);
-  this->setLocation(F.get()->getLocation());
-}
-
-OverloadIterator::reference OverloadIterator::operator*() const {
-  if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
-    return FD;
-
-  if (FunctionTemplateDecl *FTD = dyn_cast<FunctionTemplateDecl>(D))
-    return FTD;
-
-  assert(isa<OverloadedFunctionDecl>(D));
-  return *Iter;
-}
-
-OverloadIterator &OverloadIterator::operator++() {
-  if (isa<FunctionDecl>(D) || isa<FunctionTemplateDecl>(D)) {
-    D = 0;
-    return *this;
-  }
-
-  if (++Iter == cast<OverloadedFunctionDecl>(D)->function_end())
-    D = 0;
-
-  return *this;
-}
-
-bool OverloadIterator::Equals(const OverloadIterator &Other) const {
-  if (!D || !Other.D)
-    return D == Other.D;
-
-  if (D != Other.D)
-    return false;
-
-  return !isa<OverloadedFunctionDecl>(D) || Iter == Other.Iter;
-}
-
 FriendDecl *FriendDecl::Create(ASTContext &C, DeclContext *DC,
                                SourceLocation L,
                                FriendUnion Friend,
diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp
index a5982cfd..2c3b927 100644
--- a/lib/AST/DeclPrinter.cpp
+++ b/lib/AST/DeclPrinter.cpp
@@ -52,7 +52,6 @@
     void VisitVarDecl(VarDecl *D);
     void VisitParmVarDecl(ParmVarDecl *D);
     void VisitFileScopeAsmDecl(FileScopeAsmDecl *D);
-    void VisitOverloadedFunctionDecl(OverloadedFunctionDecl *D);
     void VisitNamespaceDecl(NamespaceDecl *D);
     void VisitUsingDirectiveDecl(UsingDirectiveDecl *D);
     void VisitNamespaceAliasDecl(NamespaceAliasDecl *D);
@@ -488,11 +487,6 @@
 //----------------------------------------------------------------------------
 // C++ declarations
 //----------------------------------------------------------------------------
-void DeclPrinter::VisitOverloadedFunctionDecl(OverloadedFunctionDecl *D) {
-  assert(false &&
-         "OverloadedFunctionDecls aren't really decls and are never printed");
-}
-
 void DeclPrinter::VisitNamespaceDecl(NamespaceDecl *D) {
   Out << "namespace " << D->getNameAsString() << " {\n";
   VisitDeclContext(D);
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 624a620..28f1bd9 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -118,7 +118,6 @@
                (Qualifier? HasQualifierFlag : 0) |
                (TemplateArgs ? HasExplicitTemplateArgumentListFlag : 0)),
     Loc(NameLoc) {
-  assert(!isa<OverloadedFunctionDecl>(D));
   if (Qualifier) {
     NameQualifier *NQ = getNameQualifier();
     NQ->NNS = Qualifier;
@@ -944,8 +943,7 @@
   return isa<VarDecl>(Decl) || isa<FieldDecl>(Decl) ||
     // C++ 3.10p2: An lvalue refers to an object or function.
     (Ctx.getLangOptions().CPlusPlus &&
-     (isa<FunctionDecl>(Decl) || isa<OverloadedFunctionDecl>(Decl) ||
-      isa<FunctionTemplateDecl>(Decl)));
+     (isa<FunctionDecl>(Decl) || isa<FunctionTemplateDecl>(Decl)));
 }
 
 /// isLvalue - C99 6.3.2.1: an lvalue is an expression with an object type or an
diff --git a/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp
index 1b6b022..e2d772b 100644
--- a/lib/AST/StmtProfile.cpp
+++ b/lib/AST/StmtProfile.cpp
@@ -659,13 +659,6 @@
       ID.AddInteger(TTP->getIndex());
       return;
     }
-
-    if (OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(D)) {
-      // The Itanium C++ ABI mangles references to a set of overloaded
-      // functions using just the function name, so we do the same here.
-      VisitName(Ovl->getDeclName());
-      return;
-    }
   }
 
   ID.AddPointer(D? D->getCanonicalDecl() : 0);
diff --git a/lib/Sema/Lookup.h b/lib/Sema/Lookup.h
index 61d8a4e..78f79ea 100644
--- a/lib/Sema/Lookup.h
+++ b/lib/Sema/Lookup.h
@@ -33,12 +33,11 @@
     NotFound = 0,
 
     /// @brief Name lookup found a single declaration that met the
-    /// criteria. getAsDecl will return this declaration.
+    /// criteria.  getFoundDecl() will return this declaration.
     Found,
 
     /// @brief Name lookup found a set of overloaded functions that
-    /// met the criteria. getAsDecl will turn this set of overloaded
-    /// functions into an OverloadedFunctionDecl.
+    /// met the criteria.
     FoundOverloaded,
 
     /// @brief Name lookup found an unresolvable value declaration
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 726e4a0..fdeda40 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -255,12 +255,13 @@
 }
 
 // IsOverload - Determine whether the given New declaration is an
-// overload of the Old declaration. This routine returns false if New
-// and Old cannot be overloaded, e.g., if they are functions with the
-// same signature (C++ 1.3.10) or if the Old declaration isn't a
-// function (or overload set). When it does return false and Old is an
-// OverloadedFunctionDecl, MatchedDecl will be set to point to the
-// FunctionDecl that New cannot be overloaded with.
+// overload of the declarations in Old. This routine returns false if
+// New and Old cannot be overloaded, e.g., if New has the same
+// signature as some function in Old (C++ 1.3.10) or if the Old
+// declarations aren't functions (or function templates) at all. When
+// it does return false and Old is an overload set, MatchedDecl will
+// be set to point to the FunctionDecl that New cannot be overloaded
+// with.
 //
 // Example: Given the following input:
 //
@@ -271,37 +272,37 @@
 // When we process #1, there is no previous declaration of "f",
 // so IsOverload will not be used.
 //
-// When we process #2, Old is a FunctionDecl for #1.  By comparing the
-// parameter types, we see that #1 and #2 are overloaded (since they
-// have different signatures), so this routine returns false;
-// MatchedDecl is unchanged.
+// When we process #2, Old contains only the FunctionDecl for #1.  By
+// comparing the parameter types, we see that #1 and #2 are overloaded
+// (since they have different signatures), so this routine returns
+// false; MatchedDecl is unchanged.
 //
-// When we process #3, Old is an OverloadedFunctionDecl containing #1
-// and #2. We compare the signatures of #3 to #1 (they're overloaded,
-// so we do nothing) and then #3 to #2. Since the signatures of #3 and
-// #2 are identical (return types of functions are not part of the
+// When we process #3, Old is an overload set containing #1 and #2. We
+// compare the signatures of #3 to #1 (they're overloaded, so we do
+// nothing) and then #3 to #2. Since the signatures of #3 and #2 are
+// identical (return types of functions are not part of the
 // signature), IsOverload returns false and MatchedDecl will be set to
 // point to the FunctionDecl for #2.
 bool
-Sema::IsOverload(FunctionDecl *New, LookupResult &Previous, NamedDecl *&Match) {
-  for (LookupResult::iterator I = Previous.begin(), E = Previous.end();
+Sema::IsOverload(FunctionDecl *New, LookupResult &Old, NamedDecl *&Match) {
+  for (LookupResult::iterator I = Old.begin(), E = Old.end();
          I != E; ++I) {
-    NamedDecl *Old = (*I)->getUnderlyingDecl();
-    if (FunctionTemplateDecl *OldT = dyn_cast<FunctionTemplateDecl>(Old)) {
+    NamedDecl *OldD = (*I)->getUnderlyingDecl();
+    if (FunctionTemplateDecl *OldT = dyn_cast<FunctionTemplateDecl>(OldD)) {
       if (!IsOverload(New, OldT->getTemplatedDecl())) {
-        Match = Old;
+        Match = OldT;
         return false;
       }
-    } else if (FunctionDecl *OldF = dyn_cast<FunctionDecl>(Old)) {
+    } else if (FunctionDecl *OldF = dyn_cast<FunctionDecl>(OldD)) {
       if (!IsOverload(New, OldF)) {
-        Match = Old;
+        Match = OldF;
         return false;
       }
     } else {
       // (C++ 13p1):
       //   Only function declarations can be overloaded; object and type
       //   declarations cannot be overloaded.
-      Match = Old;
+      Match = OldD;
       return false;
     }
   }