[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169829 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Argyrios Kyrtzidis 2012-12-11 07:48:08 +00:00
Родитель acb2b8dd66
Коммит a89b618a04
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -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);