]> granicus.if.org Git - clang/commitdiff
[Modules] Work around PR23030 again, in a different code path, where
authorChandler Carruth <chandlerc@gmail.com>
Fri, 27 Mar 2015 21:40:58 +0000 (21:40 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 27 Mar 2015 21:40:58 +0000 (21:40 +0000)
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

lib/Serialization/ASTWriterDecl.cpp

index 3632672e37bd78d4e93cc3d51ffd215b94bebdc8..608aa598cf480a92a0386091576989be4f18824d 100644 (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);
     }