diff options
Diffstat (limited to 'lib/Lex/PPCaching.cpp')
-rw-r--r-- | lib/Lex/PPCaching.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Lex/PPCaching.cpp b/lib/Lex/PPCaching.cpp index 53aa09c130..808787864b 100644 --- a/lib/Lex/PPCaching.cpp +++ b/lib/Lex/PPCaching.cpp @@ -102,7 +102,8 @@ void Preprocessor::AnnotatePreviousCachedTokens(const Token &Tok) { assert((BacktrackPositions.empty() || BacktrackPositions.back() < i) && "The backtrack pos points inside the annotated tokens!"); // Replace the cached tokens with the single annotation token. - CachedTokens.erase(AnnotBegin + 1, CachedTokens.begin() + CachedLexPos); + if (i < CachedLexPos) + CachedTokens.erase(AnnotBegin + 1, CachedTokens.begin() + CachedLexPos); *AnnotBegin = Tok; CachedLexPos = i; return; |