]> granicus.if.org Git - clang/commitdiff
Remove all of Sema's explicit uses of OverloadedFunctionDecl except for
authorJohn McCall <rjmccall@apple.com>
Mon, 30 Nov 2009 22:55:35 +0000 (22:55 +0000)
committerJohn McCall <rjmccall@apple.com>
Mon, 30 Nov 2009 22:55:35 +0000 (22:55 +0000)
those associated with TemplateNames.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90162 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaCodeComplete.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaTemplate.cpp
lib/Sema/SemaTemplateInstantiateDecl.cpp

index 20c69a467e978dcf9f2b378a3936ca4185ca0c01..e1a5790a8b7889715bf66a1cfa00f33bc77d2e8d 100644 (file)
@@ -206,17 +206,6 @@ void ResultBuilder::MaybeAddResult(Result R, DeclContext *CurContext) {
     MaybeAddResult(Result(Using->getTargetDecl(), R.Rank, R.Qualifier),
                    CurContext);
   
-  // Handle each declaration in an overload set separately.
-  if (OverloadedFunctionDecl *Ovl 
-        = dyn_cast<OverloadedFunctionDecl>(R.Declaration)) {
-    for (OverloadedFunctionDecl::function_iterator F = Ovl->function_begin(),
-         FEnd = Ovl->function_end();
-         F != FEnd; ++F)
-      MaybeAddResult(Result(*F, R.Rank, R.Qualifier), CurContext);
-    
-    return;
-  }
-  
   Decl *CanonDecl = R.Declaration->getCanonicalDecl();
   unsigned IDNS = CanonDecl->getIdentifierNamespace();
   
index c987a7f11cd07e0200730354c88394ef159e7594..520d7de710bd761bf6ae889d58ecb5328b2248dc 100644 (file)
@@ -401,37 +401,6 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext) {
 }
 
 bool Sema::isDeclInScope(NamedDecl *&D, DeclContext *Ctx, Scope *S) {
-  if (OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(D)) {
-    // Look inside the overload set to determine if any of the declarations
-    // are in scope. (Possibly) build a new overload set containing only
-    // those declarations that are in scope.
-    OverloadedFunctionDecl *NewOvl = 0;
-    bool FoundInScope = false;
-    for (OverloadedFunctionDecl::function_iterator F = Ovl->function_begin(),
-         FEnd = Ovl->function_end();
-         F != FEnd; ++F) {
-      NamedDecl *FD = F->get();
-      if (!isDeclInScope(FD, Ctx, S)) {
-        if (!NewOvl && F != Ovl->function_begin()) {
-          NewOvl = OverloadedFunctionDecl::Create(Context, 
-                                                  F->get()->getDeclContext(),
-                                                  F->get()->getDeclName());
-          D = NewOvl;
-          for (OverloadedFunctionDecl::function_iterator 
-               First = Ovl->function_begin();
-               First != F; ++First)
-            NewOvl->addOverload(*First);
-        }
-      } else {
-        FoundInScope = true;
-        if (NewOvl)
-          NewOvl->addOverload(*F);
-      }
-    }
-    
-    return FoundInScope;
-  }
-  
   return IdResolver.isDeclInScope(D, Ctx, Context, S);
 }
 
@@ -805,9 +774,6 @@ struct GNUCompatibleParamWarning {
 ///
 /// Returns true if there was an error, false otherwise.
 bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) {
-  assert(!isa<OverloadedFunctionDecl>(OldD) &&
-         "Cannot merge with an overloaded function declaration");
-
   // Verify the old decl was also a function.
   FunctionDecl *Old = 0;
   if (FunctionTemplateDecl *OldFunctionTemplate
@@ -2237,8 +2203,6 @@ isOutOfScopePreviousDeclaration(NamedDecl *PrevDecl, DeclContext *DC,
   if (!PrevDecl)
     return 0;
 
-  // FIXME: PrevDecl could be an OverloadedFunctionDecl, in which
-  // case we need to check each of the overloaded functions.
   if (!PrevDecl->hasLinkage())
     return false;
 
index 94449e27707d47a1256cc7f8a170b903fed44a3c..3a97ee5d9d2c08de3260dce3fafdf430f4d7707c 100644 (file)
@@ -417,8 +417,6 @@ static bool ShouldSnapshotBlockValueReference(BlockSemaInfo *CurBlock,
 Sema::OwningExprResult
 Sema::BuildDeclRefExpr(NamedDecl *D, QualType Ty, SourceLocation Loc,
                        const CXXScopeSpec *SS) {
-  assert(!isa<OverloadedFunctionDecl>(D));
-
   if (Context.getCanonicalType(Ty) == Context.UndeducedAutoTy) {
     Diag(Loc,
          diag::err_auto_variable_cannot_appear_in_own_initializer)
index 36895d4726c5b8b84b6987020f2609f83328c3a9..f47577e9097ea909af6054ec423a4c77883c7138 100644 (file)
@@ -58,43 +58,6 @@ static NamedDecl *isAcceptableTemplateName(ASTContext &Context, NamedDecl *D) {
     return 0;
   }
 
-  OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(D);
-  if (!Ovl)
-    return 0;
-
-  for (OverloadedFunctionDecl::function_iterator F = Ovl->function_begin(),
-                                              FEnd = Ovl->function_end();
-       F != FEnd; ++F) {
-    if (FunctionTemplateDecl *FuncTmpl = dyn_cast<FunctionTemplateDecl>(*F)) {
-      // We've found a function template. Determine whether there are
-      // any other function templates we need to bundle together in an
-      // OverloadedFunctionDecl
-      for (++F; F != FEnd; ++F) {
-        if (isa<FunctionTemplateDecl>(*F))
-          break;
-      }
-
-      if (F != FEnd) {
-        // Build an overloaded function decl containing only the
-        // function templates in Ovl.
-        OverloadedFunctionDecl *OvlTemplate
-          = OverloadedFunctionDecl::Create(Context,
-                                           Ovl->getDeclContext(),
-                                           Ovl->getDeclName());
-        OvlTemplate->addOverload(FuncTmpl);
-        OvlTemplate->addOverload(*F);
-        for (++F; F != FEnd; ++F) {
-          if (isa<FunctionTemplateDecl>(*F))
-            OvlTemplate->addOverload(*F);
-        }
-
-        return OvlTemplate;
-      }
-
-      return FuncTmpl;
-    }
-  }
-
   return 0;
 }
 
index ba75ee90b0fba435412b4309079692d61470d9e0..a1258572ccb4cd9264265184e3055d25cc0a87b9 100644 (file)
@@ -1883,22 +1883,6 @@ DeclContext *Sema::FindInstantiatedContext(DeclContext* DC,
 /// this mapping from within the instantiation of X<int>.
 NamedDecl *Sema::FindInstantiatedDecl(NamedDecl *D,
                           const MultiLevelTemplateArgumentList &TemplateArgs) {
-  if (OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(D)) {
-    // Transform all of the elements of the overloaded function set.
-    OverloadedFunctionDecl *Result
-      = OverloadedFunctionDecl::Create(Context, CurContext, Ovl->getDeclName());
-
-    for (OverloadedFunctionDecl::function_iterator F = Ovl->function_begin(),
-                                                FEnd = Ovl->function_end();
-         F != FEnd; ++F) {
-      Result->addOverload(
-        AnyFunctionDecl::getFromNamedDecl(FindInstantiatedDecl(*F,
-                                                               TemplateArgs)));
-    }
-
-    return Result;
-  }
-
   DeclContext *ParentDC = D->getDeclContext();
   if (isa<ParmVarDecl>(D) || isa<NonTypeTemplateParmDecl>(D) ||
       isa<TemplateTypeParmDecl>(D) || isa<TemplateTypeParmDecl>(D) ||