aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2010-07-28 21:07:02 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2010-07-28 21:07:02 +0000
commit887d6b08fd87a1d0b525d87ab6895ea0aca57ea3 (patch)
tree30ff1ab4444ac2f94ed80be0340d96c92a2017fd /clang/lib/Basic/SourceManager.cpp
parent7e4163d48e7ff4657a7f5031eb03cdaa92ba39dd (diff)
downloadllvm-887d6b08fd87a1d0b525d87ab6895ea0aca57ea3.zip
llvm-887d6b08fd87a1d0b525d87ab6895ea0aca57ea3.tar.gz
llvm-887d6b08fd87a1d0b525d87ab6895ea0aca57ea3.tar.bz2
Add a test case for tentative definitions in chained PCH. Fix a bug that completely messed up source locations and thus caused a crash whenever a diagnostic was emitted in chained PCH files.
llvm-svn: 109660
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 4a1eb30..0a6ce4c 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -424,9 +424,12 @@ void SourceManager::PreallocateSLocEntries(ExternalSLocEntrySource *Source,
unsigned NextOffset) {
ExternalSLocEntries = Source;
this->NextOffset = NextOffset;
+ unsigned CurPrealloc = SLocEntryLoaded.size();
+ // If we've ever preallocated, we must not count the dummy entry.
+ if (CurPrealloc) --CurPrealloc;
SLocEntryLoaded.resize(NumSLocEntries + 1);
SLocEntryLoaded[0] = true;
- SLocEntryTable.resize(SLocEntryTable.size() + NumSLocEntries);
+ SLocEntryTable.resize(SLocEntryTable.size() + NumSLocEntries - CurPrealloc);
}
void SourceManager::ClearPreallocatedSLocEntries() {