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 | c3f09ad253b6d72f411adc70cd58a40710886a19 (patch) | |
tree | 267d89ab6a7026d9a6298562fcbb873dd26cb3e7 /clang/lib/Sema/SemaLookup.cpp | |
parent | ea305edd63da4b03f49df6e31fd35a8fd3b7c5a8 (diff) | |
download | bcm5719-llvm-c3f09ad253b6d72f411adc70cd58a40710886a19.tar.gz bcm5719-llvm-c3f09ad253b6d72f411adc70cd58a40710886a19.zip |
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).
llvm-svn: 91677
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 5e60cc8727a..aac3ffe6dd8 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/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); } |