[cfe-commits] r90162 - in /cfe/trunk/lib/Sema: SemaCodeComplete.cpp SemaDecl.cpp SemaExpr.cpp SemaTemplate.cpp SemaTemplateInstantiateDecl.cpp

John McCall rjmccall at apple.com
Mon Nov 30 14:55:35 PST 2009


Author: rjmccall
Date: Mon Nov 30 16:55:35 2009
New Revision: 90162

URL: http://llvm.org/viewvc/llvm-project?rev=90162&view=rev
Log:
Remove all of Sema's explicit uses of OverloadedFunctionDecl except for
those associated with TemplateNames.


Modified:
    cfe/trunk/lib/Sema/SemaCodeComplete.cpp
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaTemplate.cpp
    cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Mon Nov 30 16:55:35 2009
@@ -206,17 +206,6 @@
     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();
   

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Nov 30 16:55:35 2009
@@ -401,37 +401,6 @@
 }
 
 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 @@
 ///
 /// 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 @@
   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;
 

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Nov 30 16:55:35 2009
@@ -417,8 +417,6 @@
 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)

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Mon Nov 30 16:55:35 2009
@@ -58,43 +58,6 @@
     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;
 }
 

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Mon Nov 30 16:55:35 2009
@@ -1883,22 +1883,6 @@
 /// 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) ||





More information about the cfe-commits mailing list