summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaLookup.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-03-27 12:51:49 +0000
committerDouglas Gregor <dgregor@apple.com>2013-03-27 12:51:49 +0000
commitb0d0aa5cdc8608dd451a71446738d63d56711314 (patch)
tree94dddc73a0001f99284c025874dd6cd717746c05 /clang/lib/Sema/SemaLookup.cpp
parent11820f4bf0532db7d3e4d2178c976c685d171cc8 (diff)
downloadbcm5719-llvm-b0d0aa5cdc8608dd451a71446738d63d56711314.tar.gz
bcm5719-llvm-b0d0aa5cdc8608dd451a71446738d63d56711314.zip
<rdar://problem/13317030> Consider using directives when performing unqualified name lookup into declarations contexts represented by the qualified-id but not in the actual scope hierarchy.
llvm-svn: 178136
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r--clang/lib/Sema/SemaLookup.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index ad5b89a43ab..0fe3db1901f 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -945,6 +945,21 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
continue;
}
+ // If this is a file context, we need to perform unqualified name
+ // lookup considering using directives.
+ if (Ctx->isFileContext()) {
+ UnqualUsingDirectiveSet UDirs;
+ UDirs.visit(Ctx, Ctx);
+ UDirs.done();
+
+ if (CppNamespaceLookup(*this, R, Context, Ctx, UDirs)) {
+ R.resolveKind();
+ return true;
+ }
+
+ continue;
+ }
+
// Perform qualified name lookup into this context.
// FIXME: In some cases, we know that every name that could be found by
// this qualified name lookup will also be on the identifier chain. For
@@ -979,7 +994,6 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
// Unqualified name lookup in C++ requires looking into scopes
// that aren't strictly lexical, and therefore we walk through the
// context as well as walking through the scopes.
-
for (; S; S = S->getParent()) {
// Check whether the IdResolver has anything in this scope.
bool Found = false;
OpenPOWER on IntegriCloud