TARGET_OPTIONS = 4,
/// \brief Record code for the original file that was used to
- /// generate the AST file.
- ORIGINAL_FILE_NAME = 5,
-
- /// \brief Record code for the file ID of the original file used to
- /// generate the AST file.
- ORIGINAL_FILE_ID = 6,
+ /// generate the AST file, including both its file ID and its
+ /// name.
+ ORIGINAL_FILE = 5,
/// \brief The directory that the PCH was originally created in.
- ORIGINAL_PCH_DIR = 7
+ ORIGINAL_PCH_DIR = 6
};
/// \brief Record types that occur within the AST block itself.
break;
}
- case ORIGINAL_FILE_NAME:
+ case ORIGINAL_FILE:
// Only record from the primary AST file.
if (&F == *ModuleMgr.begin()) {
- // The primary AST will be the last to get here, so it will be the one
- // that's used.
+ OriginalFileID = FileID::get(Record[0]);
+
ActualOriginalFileName.assign(BlobStart, BlobLen);
OriginalFileName = ActualOriginalFileName;
MaybeAddSystemRootToFilename(OriginalFileName);
}
break;
- case ORIGINAL_FILE_ID:
- // Only record from the primary AST file.
- if (&F == *ModuleMgr.begin()) {
- OriginalFileID = FileID::get(Record[0]);
- }
- break;
-
case ORIGINAL_PCH_DIR:
// Only record from the primary AST file.
if (&F == *ModuleMgr.begin()) {
Record.clear();
const char *BlobStart = 0;
unsigned BlobLen = 0;
- if (Stream.ReadRecord(Code, Record, &BlobStart, &BlobLen)
- == ORIGINAL_FILE_NAME)
+ if (Stream.ReadRecord(Code, Record, &BlobStart, &BlobLen) == ORIGINAL_FILE)
return std::string(BlobStart, BlobLen);
}
RECORD(IMPORTS);
RECORD(LANGUAGE_OPTIONS);
RECORD(TARGET_OPTIONS);
- RECORD(ORIGINAL_FILE_NAME);
- RECORD(ORIGINAL_FILE_ID);
+ RECORD(ORIGINAL_FILE);
RECORD(ORIGINAL_PCH_DIR);
// AST Top-Level Block.
SourceManager &SM = Context.getSourceManager();
if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) {
BitCodeAbbrev *FileAbbrev = new BitCodeAbbrev();
- FileAbbrev->Add(BitCodeAbbrevOp(ORIGINAL_FILE_NAME));
+ FileAbbrev->Add(BitCodeAbbrevOp(ORIGINAL_FILE));
+ FileAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // File ID
FileAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // File name
unsigned FileAbbrevCode = Stream.EmitAbbrev(FileAbbrev);
MainFileNameStr = adjustFilenameForRelocatablePCH(MainFileNameStr,
isysroot);
RecordData Record;
- Record.push_back(ORIGINAL_FILE_NAME);
+ Record.push_back(ORIGINAL_FILE);
+ Record.push_back(SM.getMainFileID().getOpaqueValue());
Stream.EmitRecordWithBlob(FileAbbrevCode, Record, MainFileNameStr);
-
Record.clear();
- Record.push_back(SM.getMainFileID().getOpaqueValue());
- Stream.EmitRecord(ORIGINAL_FILE_ID, Record);
}
// Original PCH directory