aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-09-21 01:30:00 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-09-21 01:30:00 +0000
commit1f94124b76680211f3585ac8c3b24b247f46fac3 (patch)
tree512371c9ddd04e1e9a5b912c820ecdec7881e714 /lib/Serialization
parentcc85d217d329aa3c78aa3f57a238e5b7931ee2c5 (diff)
[PCH] After deserializing a DeclContext, if it has external lexical decls but not
external visible decls, call DeclContext::setMustBuildLookupTable so that the "lazy decls" bit of the LookupPtr is set. Previously, in non-C++, if there were no new declarations causing the "lazy decls" bit to be set, then DeclContext::lookups_begin() would fail to return the decls from the PCH. Fixes rdar://12316296. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164351 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization')
-rw-r--r--lib/Serialization/ASTReader.cpp4
-rw-r--r--lib/Serialization/ASTReaderDecl.cpp3
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index 478217bd03..9fe6ef317e 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -1661,6 +1661,10 @@ ASTReader::ReadASTBlock(ModuleFile &F) {
return Failure;
}
+ DeclContext *DC = Context.getTranslationUnitDecl();
+ if (!DC->hasExternalVisibleStorage() && DC->hasExternalLexicalStorage())
+ DC->setMustBuildLookupTable();
+
return Success;
}
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp
index 754ff36db7..c9788a3216 100644
--- a/lib/Serialization/ASTReaderDecl.cpp
+++ b/lib/Serialization/ASTReaderDecl.cpp
@@ -2127,6 +2127,9 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) {
}
PendingVisibleUpdates.erase(I);
}
+
+ if (!DC->hasExternalVisibleStorage() && DC->hasExternalLexicalStorage())
+ DC->setMustBuildLookupTable();
}
assert(Idx == Record.size());