diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-07-28 21:07:02 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-07-28 21:07:02 +0000 |
commit | b86238d2f0a93ce91717906f9211927f48a7121a (patch) | |
tree | f5b72e794f8834ad62a2ad821a6ec3919504dff2 /lib/Basic/SourceManager.cpp | |
parent | 7edddb896e10d7ab494927842f7402583d9fa02d (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109660 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/SourceManager.cpp')
-rw-r--r-- | lib/Basic/SourceManager.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp index 4a1eb3096d..0a6ce4c03e 100644 --- a/lib/Basic/SourceManager.cpp +++ b/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() { |