aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-04-10 09:52:05 +0000
committerManuel Klimek <klimek@google.com>2013-04-10 09:52:05 +0000
commit423dd93c8011aa8bca9b761b0b121ea8bce0fd03 (patch)
tree67f1e06375115bb6c1b6dead979ba6d1e283b1d2 /unittests
parentac3223e45e7d17c65b143439313800eef4fdf71d (diff)
downloadclang-423dd93c8011aa8bca9b761b0b121ea8bce0fd03.tar.gz
Fixes recovering from errors when parsing braced init lists.
Before we would build huge unwrapped lines which take a long time to optimze. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179168 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Format/FormatTest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index fbde283e95..5b5f483c62 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -3734,5 +3734,19 @@ TEST_F(FormatTest, DoNotBreakStringLiteralsInEscapeSequence) {
format("R\"(\\x\\x00)\"\n", getLLVMStyleWithColumns(7)));
}
+TEST_F(FormatTest, DoNotCreateUnreasonableUnwrappedLines) {
+ verifyFormat("void f() {\n"
+ " return g() {}\n"
+ " void h() {}");
+ verifyFormat("if (foo)\n"
+ " return { forgot_closing_brace();\n"
+ "test();");
+ verifyFormat("int a[] = { void forgot_closing_brace()\n"
+ "{\n"
+ " f();\n"
+ " g();\n"
+ "}");
+}
+
} // end namespace tooling
} // end namespace clang