r233426 - [Modules] Work around PR23030 again, in a different code path, where
Chandler Carruth
chandlerc at gmail.com
Fri Mar 27 14:40:58 PDT 2015
Author: chandlerc
Date: Fri Mar 27 16:40:58 2015
New Revision: 233426
URL: http://llvm.org/viewvc/llvm-project?rev=233426&view=rev
Log:
[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.
Modified:
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=233426&r1=233425&r2=233426&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Fri Mar 27 16:40:58 2015
@@ -994,13 +994,16 @@ void ASTDeclWriter::VisitNamespaceDecl(N
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);
}
More information about the cfe-commits
mailing list