Author: vvassilev Date: Wed Apr 6 15:56:03 2016 New Revision: 265597 URL: http://llvm.org/viewvc/llvm-project?rev=265597&view=rev Log: [modules] Don't try to add lookup results to non-lookup contexts.
Fixes https://llvm.org/bugs/show_bug.cgi?id=27186 Patch reviewed by Richard Smith. Modified: cfe/trunk/lib/AST/DeclBase.cpp cfe/trunk/lib/Serialization/ASTWriter.cpp Modified: cfe/trunk/lib/AST/DeclBase.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=265597&r1=265596&r2=265597&view=diff ============================================================================== --- cfe/trunk/lib/AST/DeclBase.cpp (original) +++ cfe/trunk/lib/AST/DeclBase.cpp Wed Apr 6 15:56:03 2016 @@ -1559,9 +1559,12 @@ void DeclContext::makeDeclVisibleInConte 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)) Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=265597&r1=265596&r2=265597&view=diff ============================================================================== --- cfe/trunk/lib/Serialization/ASTWriter.cpp (original) +++ cfe/trunk/lib/Serialization/ASTWriter.cpp Wed Apr 6 15:56:03 2016 @@ -5736,6 +5736,9 @@ static bool isImportedDeclContext(ASTRea } 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; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits