[PCH] When writing out the list of input files, avoid emitting duplicate

entries of the same file.

This can happen because the file was "included" multiple times and is
referenced by multiple SLocEntries.

llvm-svn: 169829
This commit is contained in:
Argyrios Kyrtzidis 2012-12-11 07:48:08 +00:00
parent 54af660d2c
commit e65856fe60
1 changed files with 6 additions and 1 deletions

View File

@ -1235,9 +1235,14 @@ void ASTWriter::WriteInputFiles(SourceManager &SourceMgr, StringRef isysroot) {
if (!Cache->OrigEntry)
continue;
uint32_t &InputFileID = InputFileIDs[Cache->OrigEntry];
if (InputFileID != 0)
continue; // already recorded this file.
// Record this entry's offset.
InputFileOffsets.push_back(Stream.GetCurrentBitNo());
InputFileIDs[Cache->OrigEntry] = InputFileOffsets.size();
InputFileID = InputFileOffsets.size();
Record.clear();
Record.push_back(INPUT_FILE);