diff options
author | Reid Kleckner <rnk@google.com> | 2016-10-20 20:53:20 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-10-20 20:53:20 +0000 |
commit | ae818501b7d891512de45c1f7362045c53440a46 (patch) | |
tree | cad98b7a755a9f4ea661ab2ebb1eb7c7ecc5b989 /clang/lib/Lex/PPCaching.cpp | |
parent | 94dff2c0af5cd8bb3877e6defad76e6cec60d1e8 (diff) | |
download | bcm5719-llvm-ae818501b7d891512de45c1f7362045c53440a46.tar.gz bcm5719-llvm-ae818501b7d891512de45c1f7362045c53440a46.zip |
Fix off-by-one error in PPCaching.cpp token annotation assertion
This assert is intended to defend against backtracking into the middle
of a sequence of tokens that is being replaced with an annotation, but
it's OK if we backtrack to the exact position of the start of the
annotation sequence. Use a <= comparison instead of <.
Fixes PR25946
llvm-svn: 284777
Diffstat (limited to 'clang/lib/Lex/PPCaching.cpp')
-rw-r--r-- | clang/lib/Lex/PPCaching.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPCaching.cpp b/clang/lib/Lex/PPCaching.cpp index 4742aae5c12..ae07ea9bcfd 100644 --- a/clang/lib/Lex/PPCaching.cpp +++ b/clang/lib/Lex/PPCaching.cpp @@ -105,7 +105,7 @@ void Preprocessor::AnnotatePreviousCachedTokens(const Token &Tok) { for (CachedTokensTy::size_type i = CachedLexPos; i != 0; --i) { CachedTokensTy::iterator AnnotBegin = CachedTokens.begin() + i-1; if (AnnotBegin->getLocation() == Tok.getLocation()) { - assert((BacktrackPositions.empty() || BacktrackPositions.back() < i) && + assert((BacktrackPositions.empty() || BacktrackPositions.back() <= i) && "The backtrack pos points inside the annotated tokens!"); // Replace the cached tokens with the single annotation token. if (i < CachedLexPos) |