[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.

llvm-svn: 233426
This commit is contained in:
Chandler Carruth 2015-03-27 21:40:58 +00:00
parent df5bf99d0b
commit f089372c5c
1 changed files with 9 additions and 6 deletions

View File

@ -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);
}