]> granicus.if.org Git - clang/commitdiff
Implement a minor optimization by not introducing declarations into
authorDouglas Gregor <dgregor@apple.com>
Fri, 6 May 2011 23:32:38 +0000 (23:32 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 6 May 2011 23:32:38 +0000 (23:32 +0000)
DeclContext's lookup table when they aren't in any identifier namespace.

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

lib/AST/DeclBase.cpp

index 8f3388ee5895bc90a5cf83676636f5244c3162c4..1766d39c1405f0ecace7b4548f366ea91e7b2989 100644 (file)
@@ -1166,10 +1166,10 @@ void DeclContext::makeDeclVisibleInContextImpl(NamedDecl *D) {
   if (!D->getDeclName())
     return;
 
-  // FIXME: This feels like a hack. Should DeclarationName support
-  // template-ids, or is there a better way to keep specializations
-  // from being visible?
-  if (isa<ClassTemplateSpecializationDecl>(D) || D->isTemplateParameter())
+  // Skip entities that can't be found by name lookup into a particular
+  // context.
+  if ((D->getIdentifierNamespace() == 0 && !isa<UsingDirectiveDecl>(D)) ||
+      D->isTemplateParameter())
     return;
 
   ASTContext *C = 0;