summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/PCHReader.cpp29
-rw-r--r--clang/lib/Frontend/PCHWriter.cpp21
2 files changed, 50 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) {
diff --git a/clang/lib/Frontend/PCHWriter.cpp b/clang/lib/Frontend/PCHWriter.cpp
index 8ff688e6e36..817893448a7 100644
--- a/clang/lib/Frontend/PCHWriter.cpp
+++ b/clang/lib/Frontend/PCHWriter.cpp
@@ -355,6 +355,8 @@ void PCHWriter::WriteBlockInfoBlock() {
RECORD(SOURCE_LOCATION_OFFSETS);
RECORD(SOURCE_LOCATION_PRELOADS);
RECORD(STAT_CACHE);
+ RECORD(EXT_VECTOR_DECLS);
+ RECORD(OBJC_CATEGORY_IMPLEMENTATIONS);
// SourceManager Block.
BLOCK(SOURCE_MANAGER_BLOCK);
@@ -1656,6 +1658,17 @@ void PCHWriter::WritePCH(Sema &SemaRef, MemorizeStatCalls *StatCalls) {
TD != TDEnd; ++TD)
AddDeclRef(TD->second, LocallyScopedExternalDecls);
+ // Build a record containing all of the ext_vector declarations.
+ RecordData ExtVectorDecls;
+ for (unsigned I = 0, N = SemaRef.ExtVectorDecls.size(); I != N; ++I)
+ AddDeclRef(SemaRef.ExtVectorDecls[I], ExtVectorDecls);
+
+ // Build a record containing all of the Objective-C category
+ // implementations.
+ RecordData ObjCCategoryImpls;
+ for (unsigned I = 0, N = SemaRef.ObjCCategoryImpls.size(); I != N; ++I)
+ AddDeclRef(SemaRef.ObjCCategoryImpls[I], ObjCCategoryImpls);
+
// Write the remaining PCH contents.
RecordData Record;
Stream.EnterSubblock(pch::PCH_BLOCK_ID, 4);
@@ -1727,6 +1740,14 @@ void PCHWriter::WritePCH(Sema &SemaRef, MemorizeStatCalls *StatCalls) {
if (!LocallyScopedExternalDecls.empty())
Stream.EmitRecord(pch::LOCALLY_SCOPED_EXTERNAL_DECLS,
LocallyScopedExternalDecls);
+
+ // Write the record containing ext_vector type names.
+ if (!ExtVectorDecls.empty())
+ Stream.EmitRecord(pch::EXT_VECTOR_DECLS, ExtVectorDecls);
+
+ // Write the record containing Objective-C category implementations.
+ if (!ObjCCategoryImpls.empty())
+ Stream.EmitRecord(pch::OBJC_CATEGORY_IMPLEMENTATIONS, ObjCCategoryImpls);
// Some simple statistics
Record.clear();
OpenPOWER on IntegriCloud