summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PCHReader.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-27 20:06:05 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-27 20:06:05 +0000
commit61cac2b2954cf20760b609fc3efd1c976183cf9b (patch)
tree35b64be37e76f68f79065e2f6a733e1f7c3164e8 /clang/lib/Frontend/PCHReader.cpp
parent0e3f50d8cf054c84c8ac95f7cab20996f985056f (diff)
downloadbcm5719-llvm-61cac2b2954cf20760b609fc3efd1c976183cf9b.tar.gz
bcm5719-llvm-61cac2b2954cf20760b609fc3efd1c976183cf9b.zip
Add Sema::ExtVectorDecls and Sema::ObjCCategoryImpls to the PCH file. Since these vectors are very, very rarely used and, when used in headers, and even when used are relatively small, we load them eagerly.
llvm-svn: 70240
Diffstat (limited to 'clang/lib/Frontend/PCHReader.cpp')
-rw-r--r--clang/lib/Frontend/PCHReader.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp
index 1b26b72c5ec..d044fee4280 100644
--- a/clang/lib/Frontend/PCHReader.cpp
+++ b/clang/lib/Frontend/PCHReader.cpp
@@ -1038,6 +1038,22 @@ PCHReader::ReadPCHBlock() {
(const unsigned char *)BlobStart,
NumStatHits, NumStatMisses));
break;
+
+ case pch::EXT_VECTOR_DECLS:
+ if (!ExtVectorDecls.empty()) {
+ Error("Duplicate EXT_VECTOR_DECLS record in PCH file");
+ return Failure;
+ }
+ ExtVectorDecls.swap(Record);
+ break;
+
+ case pch::OBJC_CATEGORY_IMPLEMENTATIONS:
+ if (!ObjCCategoryImpls.empty()) {
+ Error("Duplicate OBJC_CATEGORY_IMPLEMENTATIONS record in PCH file");
+ return Failure;
+ }
+ ObjCCategoryImpls.swap(Record);
+ break;
}
}
Error("Premature end of bitstream");
@@ -1703,6 +1719,19 @@ void PCHReader::InitializeSema(Sema &S) {
NamedDecl *D = cast<NamedDecl>(GetDecl(LocallyScopedExternalDecls[I]));
SemaObj->LocallyScopedExternalDecls[D->getDeclName()] = D;
}
+
+ // If there were any ext_vector type declarations, deserialize them
+ // and add them to Sema's vector of such declarations.
+ for (unsigned I = 0, N = ExtVectorDecls.size(); I != N; ++I)
+ SemaObj->ExtVectorDecls.push_back(
+ cast<TypedefDecl>(GetDecl(ExtVectorDecls[I])));
+
+ // If there were any Objective-C category implementations,
+ // deserialize them and add them to Sema's vector of such
+ // definitions.
+ for (unsigned I = 0, N = ObjCCategoryImpls.size(); I != N; ++I)
+ SemaObj->ObjCCategoryImpls.push_back(
+ cast<ObjCCategoryImplDecl>(GetDecl(ObjCCategoryImpls[I])));
}
IdentifierInfo* PCHReader::get(const char *NameStart, const char *NameEnd) {
OpenPOWER on IntegriCloud