diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2017-09-12 08:35:57 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2017-09-12 08:35:57 +0000 |
commit | 8f738ac6d469ce3ebefe3d1c9dadcc1eda56a61c (patch) | |
tree | e82a23726ae650daaf42e9f2e800cd21c74db019 /clang/test/Index | |
parent | 47668b5e03321b28d2e85d8d35b9935cae889efa (diff) | |
download | bcm5719-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/test/Index')
-rw-r--r-- | clang/test/Index/preamble-conditionals-inverted-with-error.cpp | 8 | ||||
-rw-r--r-- | clang/test/Index/preamble-conditionals-inverted.cpp | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/Index/preamble-conditionals-inverted-with-error.cpp b/clang/test/Index/preamble-conditionals-inverted-with-error.cpp new file mode 100644 index 00000000000..95b0695b873 --- /dev/null +++ b/clang/test/Index/preamble-conditionals-inverted-with-error.cpp @@ -0,0 +1,8 @@ +// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 \ +// RUN: local -std=c++14 %s 2>&1 \ +// RUN: | FileCheck %s +#ifdef FOO_H + +void foo(); + +// CHECK: preamble-conditionals-inverted-with-error.cpp:4:2: error: unterminated conditional directive diff --git a/clang/test/Index/preamble-conditionals-inverted.cpp b/clang/test/Index/preamble-conditionals-inverted.cpp new file mode 100644 index 00000000000..1d67ccb61a0 --- /dev/null +++ b/clang/test/Index/preamble-conditionals-inverted.cpp @@ -0,0 +1,8 @@ +// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 \ +// RUN: local -std=c++14 %s 2>&1 \ +// RUN: | FileCheck %s --implicit-check-not "error:" +#ifdef FOO_H + +void foo(); + +#endif |