[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...)
llvm-svn: 244822
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user