diff options
author | John McCall <rjmccall@apple.com> | 2009-12-18 10:48:10 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-12-18 10:48:10 +0000 |
commit | 4e0d81f7088276ecf0c76824a28a9469482b067b (patch) | |
tree | 720c190e178d019f50c9fd1b8d87d2a1b5f80810 /lib/Sema/SemaLookup.cpp | |
parent | 1d7c52803e49d651a66cee782e264f62078c1da5 (diff) |
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
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
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<TypedefDecl>(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<UsingShadowDecl>(D)) + D = cast<UsingShadowDecl>(D)->getTargetDecl(); + + return isa<TypeDecl>(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<NamespaceDecl>(D) || isa<NamespaceAliasDecl>(D); } |