diff options
| author | Daniel Jasper <djasper@google.com> | 2014-04-09 13:18:49 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2014-04-09 13:18:49 +0000 |
| commit | f9fc215f821c9f60c6484e738774afae8f3bb8a3 (patch) | |
| tree | 2ae2c7ccb74f1185dd29fad1901e823822320508 /clang/unittests/Format/FormatTest.cpp | |
| parent | cf0b9bafc35c5e90123e17165b1b1c16016b7905 (diff) | |
| download | bcm5719-llvm-f9fc215f821c9f60c6484e738774afae8f3bb8a3.tar.gz bcm5719-llvm-f9fc215f821c9f60c6484e738774afae8f3bb8a3.zip | |
clang-format: Treat a trailing comment like a trailing comma in braced lists.
Before:
static StructInitInfo module = {MODULE_BUILTIN, /* type */
"streams" /* name */
};
After:
static StructInitInfo module = {
MODULE_BUILTIN, /* type */
"streams" /* name */
};
This fixes llvm.org/PR19378.
llvm-svn: 205851
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 5f44c5bb2b5..d7f1d0b4839 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -4516,8 +4516,9 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { verifyIndependentOfContext("f(b * /* confusing comment */ ++c);"); verifyFormat( - "int *MyValues = {*A, // Operator detection might be confused by the '{'\n" - " *BB // Operator detection might be confused by previous comment\n" + "int *MyValues = {\n" + " *A, // Operator detection might be confused by the '{'\n" + " *BB // Operator detection might be confused by previous comment\n" "};"); verifyIndependentOfContext("if (int *a = &b)"); @@ -5072,7 +5073,10 @@ TEST_F(FormatTest, LayoutCxx11ConstructorBraceInitializers) { " bbbbbbbbbbbbbbbbbbbb, bbbbb };", ExtraSpaces); verifyFormat("DoSomethingWithVector({} /* No data */);", ExtraSpaces); - verifyFormat("DoSomethingWithVector({ {} /* No data */ }, { { 1, 2 } });", + verifyFormat("DoSomethingWithVector({\n" + " {} /* No data */\n" + " },\n" + " { { 1, 2 } });", ExtraSpaces); verifyFormat( "someFunction(OtherParam,\n" |

