diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-08-12 22:25:24 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-08-12 22:25:24 +0000 |
| commit | 99e35f0acc90b32fe05bed9732d07836f32a9944 (patch) | |
| tree | 15c8274544d4f712860c9b56f00dadc44a222c9d /lib/Basic/SourceManager.cpp | |
| parent | 7db62e8770f58d4db87bb899113e698a95d1327f (diff) | |
[modules] If loading a .pcm file would cause us to run out of source locations, attempt to fail more gracefully. (No test; this requires >= 4GB of preprocessed input...)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244822 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/SourceManager.cpp')
| -rw-r--r-- | lib/Basic/SourceManager.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp index c0b045331d..6c2bd7d233 100644 --- a/lib/Basic/SourceManager.cpp +++ b/lib/Basic/SourceManager.cpp @@ -484,10 +484,12 @@ std::pair<int, unsigned> SourceManager::AllocateLoadedSLocEntries(unsigned NumSLocEntries, unsigned TotalSize) { assert(ExternalSLocEntries && "Don't have an external sloc source"); + // Make sure we're not about to run out of source locations. + if (CurrentLoadedOffset - TotalSize < NextLocalOffset) + return std::make_pair(0, 0); LoadedSLocEntryTable.resize(LoadedSLocEntryTable.size() + NumSLocEntries); SLocEntryLoaded.resize(LoadedSLocEntryTable.size()); CurrentLoadedOffset -= TotalSize; - assert(CurrentLoadedOffset >= NextLocalOffset && "Out of source locations"); int ID = LoadedSLocEntryTable.size(); return std::make_pair(-ID - 1, CurrentLoadedOffset); } |
