diff options
author | John McCall <rjmccall@apple.com> | 2009-11-30 22:55:35 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-11-30 22:55:35 +0000 |
commit | 7dafdf51176d2f52e3a27f1ef70161ea2133ff52 (patch) | |
tree | 30fd10f4b45ca363d3616be96238ff6d30082960 | |
parent | 129e2df52ed7e0434b3f1cf1867fd6a5cb083ff6 (diff) |
Remove all of Sema's explicit uses of OverloadedFunctionDecl except for
those associated with TemplateNames.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90162 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 11 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 36 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 37 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 16 |
5 files changed, 0 insertions, 102 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 20c69a467e..e1a5790a8b 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -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(); diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index c987a7f11c..520d7de710 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -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; diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 94449e2770..3a97ee5d9d 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -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) diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 36895d4726..f47577e909 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -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; } diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index ba75ee90b0..a1258572cc 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -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) || |