diff options
author | Sam McCall <sam.mccall@gmail.com> | 2018-01-24 17:50:20 +0000 |
---|---|---|
committer | Sam McCall <sam.mccall@gmail.com> | 2018-01-24 17:50:20 +0000 |
commit | d5376a75e7ddd7df924e04eded67a83ebc20ad95 (patch) | |
tree | ce091036e19fb60cf564ea7ef63975c5bf68cda7 /lib/Sema/SemaLookup.cpp | |
parent | 7e980e2e8ee6c9c9b2e7c0447f0b0d1a709baeb1 (diff) |
[CodeComplete] only respect LoadExternal hint at namespace/tu scope
Reviewers: ilya-biryukov
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D42428
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323347 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index 7e7eac38c1..dd54fb4ad9 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -3543,10 +3543,13 @@ static void LookupVisibleDecls(DeclContext *Ctx, LookupResult &Result, if (CXXRecordDecl *Class = dyn_cast<CXXRecordDecl>(Ctx)) Result.getSema().ForceDeclarationOfImplicitMembers(Class); + // We sometimes skip loading namespace-level results (they tend to be huge). + bool Load = LoadExternal || + !(isa<TranslationUnitDecl>(Ctx) || isa<NamespaceDecl>(Ctx)); // Enumerate all of the results in this context. for (DeclContextLookupResult R : - LoadExternal ? Ctx->lookups() - : Ctx->noload_lookups(/*PreserveInternalState=*/false)) { + Load ? Ctx->lookups() + : Ctx->noload_lookups(/*PreserveInternalState=*/false)) { for (auto *D : R) { if (auto *ND = Result.getAcceptableDecl(D)) { Consumer.FoundDecl(ND, Visited.checkHidden(ND), Ctx, InBaseClass); |