summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReader.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-04-03 22:49:41 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-04-03 22:49:41 +0000
commitc0fbba7d8a6e03f43f18373b95a96cd107d3b392 (patch)
treee904b4be78046e4b46111520312e5ec8f7e3f928 /clang/lib/Serialization/ASTReader.cpp
parent43e7e00a681dcc0a71fb54ece53f8eacad136c9a (diff)
downloadbcm5719-llvm-c0fbba7d8a6e03f43f18373b95a96cd107d3b392.tar.gz
bcm5719-llvm-c0fbba7d8a6e03f43f18373b95a96cd107d3b392.zip
Pare back r164351 somewhat. The problem that change was addressing was that we
don't serialize a lookup map for the translation unit outside C++ mode, so we can't tell when lookup within the TU needs to look within modules. Only apply the fix outside C++ mode, and only to the translation unit. llvm-svn: 178706
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r--clang/lib/Serialization/ASTReader.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 4c4277c30fd..d9844152b74 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -1995,8 +1995,14 @@ bool ASTReader::ReadASTBlock(ModuleFile &F) {
Error("error at end of module block in AST file");
return true;
case llvm::BitstreamEntry::EndBlock: {
+ // Outside of C++, we do not store a lookup map for the translation unit.
+ // Instead, mark it as needing a lookup map to be built if this module
+ // contains any declarations lexically within it (which it always does!).
+ // This usually has no cost, since we very rarely need the lookup map for
+ // the translation unit outside C++.
DeclContext *DC = Context.getTranslationUnitDecl();
- if (!DC->hasExternalVisibleStorage() && DC->hasExternalLexicalStorage())
+ if (DC->hasExternalLexicalStorage() &&
+ !getContext().getLangOpts().CPlusPlus)
DC->setMustBuildLookupTable();
return false;
OpenPOWER on IntegriCloud