From: Sean Callanan Date: Fri, 22 Jul 2011 23:46:03 +0000 (+0000) Subject: This patch (thanks to Doug Gregor) fixes a X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8cc4fd795e01d50a7a7c96f4c0356d23b00d9349;p=clang This patch (thanks to Doug Gregor) fixes a problem where Clang was setting the hasExternalVisibleDecls() bit for all DeclContexts it imported. This caused Clang to make unnecessary calls to findExternalVisibleDecls() when an external AST source was installed. In fact, Clang sometimes interpreted a failure by one of these spurious calls to find a Decl as meaning the Decl didn't exist, even though findExternalLexicalDecls() did locate that decl. This produced amusing errors of the form: - error: no member named 'b' in 'A'; did you mean 'b'? - Now, if hasExternalVisibleDecls() or hasExternalLexicalDecls() should be set, the external AST source must do so itself. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135824 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp index e8e4c6a108..d68d240346 100644 --- a/lib/AST/ASTImporter.cpp +++ b/lib/AST/ASTImporter.cpp @@ -1767,10 +1767,7 @@ ASTNodeImporter::ImportDeclarationNameLoc(const DeclarationNameInfo &From, void ASTNodeImporter::ImportDeclContext(DeclContext *FromDC, bool ForceImport) { if (Importer.isMinimalImport() && !ForceImport) { - if (DeclContext *ToDC = Importer.ImportContext(FromDC)) { - ToDC->setHasExternalLexicalStorage(); - ToDC->setHasExternalVisibleStorage(); - } + Importer.ImportContext(FromDC); return; }