diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-12-11 07:48:08 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-12-11 07:48:08 +0000 |
commit | e65856fe60f31a23aa5c5a6d8e7e93e551ce3480 (patch) | |
tree | efd7d615a66b7ca90ac62851c1e515786cbb08f2 /clang/lib/Serialization/ASTWriter.cpp | |
parent | 54af660d2cfe3da2cd6931b57668f5137c1e871a (diff) | |
download | bcm5719-llvm-e65856fe60f31a23aa5c5a6d8e7e93e551ce3480.tar.gz bcm5719-llvm-e65856fe60f31a23aa5c5a6d8e7e93e551ce3480.zip |
[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
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index ff98d9beb05..ed0a272faa0 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -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); |