[modules] Remove redundant import of lexical decls when building a lookup table
for a DeclContext, and fix propagation of exception specifications along redeclaration chains. This reverts r232905, r232907, and r232907, which reverted r232793, r232853, and r232853. One additional change is present here to resolve issues with LLDB: distinguish between whether lexical decls missing from the lookup table are local or are provided by the external AST source, and still look in the external source if that's where they came from. llvm-svn: 232928
This commit is contained in:
@@ -3021,17 +3021,45 @@ static void LookupVisibleDecls(DeclContext *Ctx, LookupResult &Result,
|
||||
if (Visited.visitedContext(Ctx->getPrimaryContext()))
|
||||
return;
|
||||
|
||||
// Outside C++, lookup results for the TU live on identifiers.
|
||||
if (isa<TranslationUnitDecl>(Ctx) &&
|
||||
!Result.getSema().getLangOpts().CPlusPlus) {
|
||||
auto &S = Result.getSema();
|
||||
auto &Idents = S.Context.Idents;
|
||||
|
||||
// Ensure all external identifiers are in the identifier table.
|
||||
if (IdentifierInfoLookup *External = Idents.getExternalIdentifierLookup()) {
|
||||
std::unique_ptr<IdentifierIterator> Iter(External->getIdentifiers());
|
||||
for (StringRef Name = Iter->Next(); !Name.empty(); Name = Iter->Next())
|
||||
Idents.get(Name);
|
||||
}
|
||||
|
||||
// Walk all lookup results in the TU for each identifier.
|
||||
for (const auto &Ident : Idents) {
|
||||
for (auto I = S.IdResolver.begin(Ident.getValue()),
|
||||
E = S.IdResolver.end();
|
||||
I != E; ++I) {
|
||||
if (S.IdResolver.isDeclInScope(*I, Ctx)) {
|
||||
if (NamedDecl *ND = Result.getAcceptableDecl(*I)) {
|
||||
Consumer.FoundDecl(ND, Visited.checkHidden(ND), Ctx, InBaseClass);
|
||||
Visited.add(ND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (CXXRecordDecl *Class = dyn_cast<CXXRecordDecl>(Ctx))
|
||||
Result.getSema().ForceDeclarationOfImplicitMembers(Class);
|
||||
|
||||
// Enumerate all of the results in this context.
|
||||
for (const auto &R : Ctx->lookups()) {
|
||||
for (auto *I : R) {
|
||||
if (NamedDecl *ND = dyn_cast<NamedDecl>(I)) {
|
||||
if ((ND = Result.getAcceptableDecl(ND))) {
|
||||
Consumer.FoundDecl(ND, Visited.checkHidden(ND), Ctx, InBaseClass);
|
||||
Visited.add(ND);
|
||||
}
|
||||
for (auto *D : R) {
|
||||
if (auto *ND = Result.getAcceptableDecl(D)) {
|
||||
Consumer.FoundDecl(ND, Visited.checkHidden(ND), Ctx, InBaseClass);
|
||||
Visited.add(ND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user