diff options
author | Daniel Jasper <djasper@google.com> | 2013-01-04 18:52:56 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-01-04 18:52:56 +0000 |
commit | 1f42f11870325d1869eb7d51b98ebf5e6d7bcc26 (patch) | |
tree | b62e5945f375315060a6d60ebb3074883a2a3a68 /unittests/Format/FormatTest.cpp | |
parent | 463b383bcd0269ab56dfa13a3b86fb382c97b515 (diff) |
Let the formatter ignore UnwrappedLines containing errors.
This prevents code like:
namespace {
class Foo {
Foo(
};
} // comment
from causing segfaults (see llvm.org/PR14774).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171495 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index e713280d91..8eadb545f7 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -859,6 +859,13 @@ TEST_F(FormatTest, IncorrectCodeDoNoWhile) { "};"); } +TEST_F(FormatTest, DoesNotTouchUnwrappedLinesWithErrors) { + verifyFormat("namespace {\n" + "class Foo {\n" + " Foo ( };\n" + "} // comment"); +} + TEST_F(FormatTest, IncorrectCodeErrorDetection) { EXPECT_EQ("{\n{\n}\n", format("{\n{\n}\n")); EXPECT_EQ("{\n {\n}\n", format("{\n {\n}\n")); |