From: John McCall Date: Fri, 18 Dec 2009 10:48:10 +0000 (+0000) Subject: Look through using decls when checking whether a name is an acceptable X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4e0d81f7088276ecf0c76824a28a9469482b067b;p=clang Look through using decls when checking whether a name is an acceptable nested-name specifier name. I accidentally checked in the test case for this in the last commit --- fortunately, that refactor was inspired by having debugged this problem already, so I can fix the bug quick (though probably not fast enough for the buildbots). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91677 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index 5e60cc8727..aac3ffe6dd 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -202,10 +202,22 @@ static bool IsAcceptableOperatorName(NamedDecl *D, unsigned IDNS) { } static bool IsAcceptableNestedNameSpecifierName(NamedDecl *D, unsigned IDNS) { - return isa(D) || D->isInIdentifierNamespace(Decl::IDNS_Tag); + // This lookup ignores everything that isn't a type. + + // This is a fast check for the far most common case. + if (D->isInIdentifierNamespace(Decl::IDNS_Tag)) + return true; + + if (isa(D)) + D = cast(D)->getTargetDecl(); + + return isa(D); } static bool IsAcceptableNamespaceName(NamedDecl *D, unsigned IDNS) { + // We don't need to look through using decls here because + // using decls aren't allowed to name namespaces. + return isa(D) || isa(D); }