diff options
author | Manuel Klimek <klimek@google.com> | 2013-04-10 09:52:05 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2013-04-10 09:52:05 +0000 |
commit | 423dd93c8011aa8bca9b761b0b121ea8bce0fd03 (patch) | |
tree | 67f1e06375115bb6c1b6dead979ba6d1e283b1d2 /unittests | |
parent | ac3223e45e7d17c65b143439313800eef4fdf71d (diff) |
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.cpp | 14 |
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 |