summaryrefslogtreecommitdiffstats
path: root/clang/unittests
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2014-01-29 08:49:02 +0000
committerManuel Klimek <klimek@google.com>2014-01-29 08:49:02 +0000
commit14bd917470dab03e3a77b16225c88c492e6d84bb (patch)
tree51d0f30c62f3a5ad403f46a6b31fd8f33ae836db /clang/unittests
parent8a4e2e41de4589696c0de021fdb0827b39959021 (diff)
downloadbcm5719-llvm-14bd917470dab03e3a77b16225c88c492e6d84bb.tar.gz
bcm5719-llvm-14bd917470dab03e3a77b16225c88c492e6d84bb.zip
Fix crash on unmatched #endif's.
The following snippet would crash: #endif #if A llvm-svn: 200381
Diffstat (limited to 'clang/unittests')
-rw-r--r--clang/unittests/Format/FormatTest.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index efc563b4f25..9b0a11c3bc2 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2427,6 +2427,11 @@ TEST_F(FormatTest, LayoutStatementsAroundPreprocessorDirectives) {
"#endif");
}
+TEST_F(FormatTest, GraciouslyHandleIncorrectPreprocessorConditions) {
+ verifyFormat("#endif\n"
+ "#if B");
+}
+
TEST_F(FormatTest, FormatsJoinedLinesOnSubsequentRuns) {
FormatStyle SingleLine = getLLVMStyle();
SingleLine.AllowShortIfStatementsOnASingleLine = true;
OpenPOWER on IntegriCloud