aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Lex/PPCaching.cpp9
-rw-r--r--test/Parser/backtrack-crash.cpp4
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/Lex/PPCaching.cpp b/lib/Lex/PPCaching.cpp
index 6aeb6fa3a2..20e3b3dd9d 100644
--- a/lib/Lex/PPCaching.cpp
+++ b/lib/Lex/PPCaching.cpp
@@ -60,13 +60,10 @@ void Preprocessor::CachingLex(Token &Result) {
return;
}
- // We should cache the lexed token.
-
+ // Cache the lexed token.
EnterCachingLexMode();
- if (Result.isNot(tok::eof)) {
- CachedTokens.push_back(Result);
- ++CachedLexPos;
- }
+ CachedTokens.push_back(Result);
+ ++CachedLexPos;
}
void Preprocessor::EnterCachingLexMode() {
diff --git a/test/Parser/backtrack-crash.cpp b/test/Parser/backtrack-crash.cpp
new file mode 100644
index 0000000000..cc26873729
--- /dev/null
+++ b/test/Parser/backtrack-crash.cpp
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
+// PR7072
+()( // expected-error {{expected unqualified-id}}
+