summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2017-09-12 08:35:57 +0000
committerIlya Biryukov <ibiryukov@google.com>2017-09-12 08:35:57 +0000
commit8f738ac6d469ce3ebefe3d1c9dadcc1eda56a61c (patch)
treee82a23726ae650daaf42e9f2e800cd21c74db019 /clang/lib/Lex
parent47668b5e03321b28d2e85d8d35b9935cae889efa (diff)
downloadbcm5719-llvm-8f738ac6d469ce3ebefe3d1c9dadcc1eda56a61c.tar.gz
bcm5719-llvm-8f738ac6d469ce3ebefe3d1c9dadcc1eda56a61c.zip
Fix recording preamble's conditional stack in skipped PP branches.
Summary: This fixes PR34547. `Lexer::LexEndOfFile` handles recording of ConditionalStack for preamble and reporting errors about unmatched conditionalal PP directives. However, SkipExcludedConditionalBlock contianed duplicated logic for reporting errors and clearing ConditionalStack, but not for preamble recording. This fix removes error reporting logic from `SkipExcludedConditionalBlock`, unmatched PP conditionals are now reported inside `Lexer::LexEndOfFile`. Reviewers: erikjv, klimek, bkramer Reviewed By: erikjv Subscribers: nik, cfe-commits Differential Revision: https://reviews.llvm.org/D37700 llvm-svn: 313014
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/PPDirectives.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 556e76356da..eb9f11f3d4d 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -383,15 +383,8 @@ void Preprocessor::SkipExcludedConditionalBlock(const Token &HashToken,
// If this is the end of the buffer, we have an error.
if (Tok.is(tok::eof)) {
- // Emit errors for each unterminated conditional on the stack, including
- // the current one.
- while (!CurPPLexer->ConditionalStack.empty()) {
- if (CurLexer->getFileLoc() != CodeCompletionFileLoc)
- Diag(CurPPLexer->ConditionalStack.back().IfLoc,
- diag::err_pp_unterminated_conditional);
- CurPPLexer->ConditionalStack.pop_back();
- }
-
+ // We don't emit errors for unterminated conditionals here,
+ // Lexer::LexEndOfFile can do that propertly.
// Just return and let the caller lex after this #include.
break;
}
OpenPOWER on IntegriCloud