When doing name lookup for members don't look into global/namespace scope.

Better performance and fixes rdar://8603569.

llvm-svn: 117656
This commit is contained in:
Argyrios Kyrtzidis 2010-10-29 16:12:50 +00:00
parent a42c78fadb
commit 706bbf84d8
2 changed files with 17 additions and 0 deletions

View File

@ -918,6 +918,10 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
// FIXME: This really, really shouldn't be happening. // FIXME: This really, really shouldn't be happening.
if (!S) return false; if (!S) return false;
// If we are looking for members, no need to look into global/namespace scope.
if (R.getLookupKind() == LookupMemberName)
return false;
// Collect UsingDirectiveDecls in all scopes, and recursively all // Collect UsingDirectiveDecls in all scopes, and recursively all
// nominated namespaces by those using-directives. // nominated namespaces by those using-directives.
// //

View File

@ -0,0 +1,13 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace A {
class String;
};
using A::String;
class String;
// rdar://8603569
union value {
char *String;
};