From: Chandler Carruth Date: Fri, 27 Mar 2015 21:40:58 +0000 (+0000) Subject: [Modules] Work around PR23030 again, in a different code path, where X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa25bc616f38ad64a652c17dd9152587f0bd4a08;p=clang [Modules] Work around PR23030 again, in a different code path, where I again added the "reasonable" assertions and they again fired during a modules self-host. This hopefully will un-break the self-host build bot. No test case handy and adding one seems to have little or no value really. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233426 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp index 3632672e37..608aa598cf 100644 --- a/lib/Serialization/ASTWriterDecl.cpp +++ b/lib/Serialization/ASTWriterDecl.cpp @@ -994,13 +994,16 @@ void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) { std::sort(LookupResults.begin(), LookupResults.end(), llvm::less_first()); for (auto &NameAndResult : LookupResults) { DeclarationName Name = NameAndResult.first; - (void)Name; - assert(Name.getNameKind() != DeclarationName::CXXConstructorName && - "Cannot have a constructor name in a namespace!"); - assert(Name.getNameKind() != DeclarationName::CXXConversionFunctionName && - "Cannot have a conversion function name in a namespace!"); - DeclContext::lookup_result Result = NameAndResult.second; + if (Name.getNameKind() == DeclarationName::CXXConstructorName || + Name.getNameKind() == DeclarationName::CXXConversionFunctionName) { + // We have to work around a name lookup bug here where negative lookup + // results for these names get cached in namespace lookup tables. + assert(Result.empty() && "Cannot have a constructor or conversion " + "function name in a namespace!"); + continue; + } + for (NamedDecl *ND : Result) Writer.GetDeclRef(ND); }