summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2017-12-13 10:26:49 +0000
committerEric Liu <ioeric@google.com>2017-12-13 10:26:49 +0000
commitfead6ae660ac5f4548250f972ccbd905a038132a (patch)
tree9ac0d1dbe776bb032f61edbc10e02bc26c540d17 /clang/lib/Sema
parent0a075d68ecd2e5c3cbf220557621a3753306698f (diff)
downloadbcm5719-llvm-fead6ae660ac5f4548250f972ccbd905a038132a.tar.gz
bcm5719-llvm-fead6ae660ac5f4548250f972ccbd905a038132a.zip
[Sema] Ignore decls in namespaces when global decls are not wanted.
Summary: ... in qualified code completion and decl lookup. Reviewers: ilya-biryukov, arphaman Reviewed By: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D40562 llvm-svn: 320563
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaCodeComplete.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 3dd3c9f59e4..ee11c5c94e0 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -4647,10 +4647,13 @@ void Sema::CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
MaybeAddOverrideCalls(*this, Ctx, Results);
Results.ExitScope();
- CodeCompletionDeclConsumer Consumer(Results, CurContext);
- LookupVisibleDecls(Ctx, LookupOrdinaryName, Consumer,
- /*IncludeGlobalScope=*/true,
- /*IncludeDependentBases=*/true);
+ if (CodeCompleter->includeNamespaceLevelDecls() ||
+ (!Ctx->isNamespace() && !Ctx->isTranslationUnit())) {
+ CodeCompletionDeclConsumer Consumer(Results, CurContext);
+ LookupVisibleDecls(Ctx, LookupOrdinaryName, Consumer,
+ /*IncludeGlobalScope=*/true,
+ /*IncludeDependentBases=*/true);
+ }
auto CC = Results.getCompletionContext();
CC.setCXXScopeSpecifier(SS);
OpenPOWER on IntegriCloud