forked from OSchip/llvm-project
[SourceManager] Explicitly check for potential iterator underflow
Differential Revision: https://reviews.llvm.org/D86231
This commit is contained in:
parent
a4e35cc2ec
commit
ae726fecae
|
@ -1936,6 +1936,11 @@ SourceManager::getMacroArgExpandedLocation(SourceLocation Loc) const {
|
|||
|
||||
assert(!MacroArgsCache->empty());
|
||||
MacroArgsMap::iterator I = MacroArgsCache->upper_bound(Offset);
|
||||
// In case every element in MacroArgsCache is greater than Offset we can't
|
||||
// decrement the iterator.
|
||||
if (I == MacroArgsCache->begin())
|
||||
return Loc;
|
||||
|
||||
--I;
|
||||
|
||||
unsigned MacroArgBeginOffs = I->first;
|
||||
|
|
Loading…
Reference in New Issue