Fixes https://llvm.org/bugs/show_bug.cgi?id=27186
Patch reviewed by Richard Smith.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265597
91177308-0d34-0410-b5e6-
96231b3b80d8
bool Recoverable) {
assert(this == getPrimaryContext() && "expected a primary DC");
- // Skip declarations within functions.
- if (isFunctionOrMethod())
+ if (!isLookupContext()) {
+ if (isTransparentContext())
+ getParent()->getPrimaryContext()
+ ->makeDeclVisibleInContextWithFlags(D, Internal, Recoverable);
return;
+ }
// Skip declarations which should be invisible to name lookup.
if (shouldBeHidden(D))
}
void ASTWriter::AddedVisibleDecl(const DeclContext *DC, const Decl *D) {
+ assert(DC->isLookupContext() &&
+ "Should not add lookup results to non-lookup contexts!");
+
// TU is handled elsewhere.
if (isa<TranslationUnitDecl>(DC))
return;