summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp4
-rw-r--r--clang/unittests/Format/FormatTest.cpp5
2 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index e127f4af8e5..b9e35126ec1 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -880,8 +880,6 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
else
return 100;
}
- if (Left.is(tok::l_brace) && Right.isNot(tok::l_brace))
- return 50;
if (Left.is(tok::equal) && Right.is(tok::l_brace))
return 150;
if (Left.is(tok::coloncolon))
@@ -917,7 +915,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
return 20;
if (Left.is(tok::l_paren) || Left.is(tok::l_square) ||
- Left.Type == TT_TemplateOpener)
+ Left.is(tok::l_brace) || Left.Type == TT_TemplateOpener)
return 20;
if (Right.is(tok::lessless)) {
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 392548dc6cc..baeb0143bc3 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -612,6 +612,11 @@ TEST_F(FormatTest, CommentsInStaticInitializers) {
"\n"
" b\n"
"};"));
+ verifyFormat("const uint8_t aaaaaaaaaaaaaaaaaaaaaa[0] = {\n"
+ " 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment\n"
+ " 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment\n"
+ " 0x00, 0x00, 0x00, 0x00 // comment\n"
+ "};");
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud