aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHReader.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-08-05 09:48:16 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-08-05 09:48:16 +0000
commit0e0363866792b309d70e9c8e92b4c239773af89c (patch)
tree3df1d201ce92c06a6812878941c859b41d9c7092 /lib/Frontend/PCHReader.cpp
parent72b90571b1783b17c3f2204cec5ca440edc38bee (diff)
Store the pending implicit instantiations in the PCH and perform them at the end of the translation unit that
included the PCH, as God intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110324 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHReader.cpp')
-rw-r--r--lib/Frontend/PCHReader.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 7229775070..98b274d175 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -1739,6 +1739,15 @@ PCHReader::ReadPCHBlock(PerFileData &F) {
DynamicClasses.swap(Record);
break;
+ case pch::PENDING_IMPLICIT_INSTANTIATIONS:
+ // Optimization for the first block.
+ if (PendingImplicitInstantiations.empty())
+ PendingImplicitInstantiations.swap(Record);
+ else
+ PendingImplicitInstantiations.insert(
+ PendingImplicitInstantiations.end(), Record.begin(), Record.end());
+ break;
+
case pch::SEMA_DECL_REFS:
if (!SemaDeclRefs.empty()) {
Error("duplicate SEMA_DECL_REFS record in PCH file");
@@ -3191,6 +3200,16 @@ void PCHReader::InitializeSema(Sema &S) {
SemaObj->DynamicClasses.push_back(
cast<CXXRecordDecl>(GetDecl(DynamicClasses[I])));
+ // If there were any pending implicit instantiations, deserialize them
+ // and add them to Sema's queue of such instantiations.
+ assert(PendingImplicitInstantiations.size() % 2 == 0 &&
+ "Expected pairs of entries");
+ for (unsigned Idx = 0, N = PendingImplicitInstantiations.size(); Idx < N;) {
+ ValueDecl *D=cast<ValueDecl>(GetDecl(PendingImplicitInstantiations[Idx++]));
+ SourceLocation Loc = ReadSourceLocation(PendingImplicitInstantiations, Idx);
+ SemaObj->PendingImplicitInstantiations.push_back(std::make_pair(D, Loc));
+ }
+
// Load the offsets of the declarations that Sema references.
// They will be lazily deserialized when needed.
if (!SemaDeclRefs.empty()) {