diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-05-06 21:43:30 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-05-06 21:43:30 +0000 |
commit | 31d375f056447d4e2418275d4913661d3bfedb3e (patch) | |
tree | 2d5853cbd1cad1f2d96875ef9f78ec314506df2e /lib/Serialization/ASTWriter.cpp | |
parent | 6bd2f6ad857949d4dfb6e75e0760c61950b917cf (diff) |
Keep track of the file ID corresponding to the original file used to
build a precompiled header. Use this information to eliminate the call
to SourceManager::getLocation() while loading a precompiled preamble,
since SourceManager::getLocation() itself causes unwanted
deserialization.
Fixed <rdar://problem/9399352>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131021 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 1c62bfd72a..720f203040 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -727,6 +727,7 @@ void ASTWriter::WriteBlockInfoBlock() { // AST Top-Level Block. BLOCK(AST_BLOCK); RECORD(ORIGINAL_FILE_NAME); + RECORD(ORIGINAL_FILE_ID); RECORD(TYPE_OFFSET); RECORD(DECL_OFFSET); RECORD(LANGUAGE_OPTIONS); @@ -953,7 +954,7 @@ void ASTWriter::WriteMetadata(ASTContext &Context, const char *isysroot, const std::string &BlobStr = Chain ? Chain->getFileName() : Target.getTriple().getTriple(); Stream.EmitRecordWithBlob(MetaAbbrevCode, Record, BlobStr); - // Original file name + // Original file name and file ID SourceManager &SM = Context.getSourceManager(); if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) { BitCodeAbbrev *FileAbbrev = new BitCodeAbbrev(); @@ -971,6 +972,10 @@ void ASTWriter::WriteMetadata(ASTContext &Context, const char *isysroot, RecordData Record; Record.push_back(ORIGINAL_FILE_NAME); Stream.EmitRecordWithBlob(FileAbbrevCode, Record, MainFileNameStr); + + Record.clear(); + Record.push_back(SM.getMainFileID().getOpaqueValue()); + Stream.EmitRecord(ORIGINAL_FILE_ID, Record); } // Original PCH directory |