From f9fc215f821c9f60c6484e738774afae8f3bb8a3 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Wed, 9 Apr 2014 13:18:49 +0000 Subject: 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 --- clang/unittests/Format/FormatTest.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'clang/unittests/Format/FormatTest.cpp') 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" -- cgit v1.2.3