forked from OSchip/llvm-project
clang-format: Fix spacing in Cpp11 braced lists:
Before: vector<int> foo{ ::SomeFunction()}; After: vector<int> foo{::SomeFunction()}; llvm-svn: 198769
This commit is contained in:
parent
95c864d9bd
commit
7620b6628b
|
@ -1278,7 +1278,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
|
|||
return false;
|
||||
if (Left.is(tok::coloncolon))
|
||||
return false;
|
||||
if (Right.is(tok::coloncolon))
|
||||
if (Right.is(tok::coloncolon) && Left.isNot(tok::l_brace))
|
||||
return (Left.is(tok::less) && Style.Standard == FormatStyle::LS_Cpp03) ||
|
||||
!Left.isOneOf(tok::identifier, tok::greater, tok::l_paren,
|
||||
tok::r_paren, tok::less);
|
||||
|
|
|
@ -4826,6 +4826,7 @@ TEST_F(FormatTest, LayoutCxx11ConstructorBraceInitializers) {
|
|||
" aaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaa,\n"
|
||||
" aaaaaaa, a\n"
|
||||
"};");
|
||||
verifyFormat("vector<int> foo = { ::SomeGlobalFunction() };");
|
||||
|
||||
FormatStyle NoSpaces = getLLVMStyle();
|
||||
NoSpaces.Cpp11BracedListStyle = true;
|
||||
|
@ -4846,6 +4847,7 @@ TEST_F(FormatTest, LayoutCxx11ConstructorBraceInitializers) {
|
|||
" T member = {arg1, arg2};\n"
|
||||
"};",
|
||||
NoSpaces);
|
||||
verifyFormat("vector<int> foo = {::SomeGlobalFunction()};", NoSpaces);
|
||||
|
||||
// FIXME: The alignment of these trailing comments might be bad. Then again,
|
||||
// this might be utterly useless in real code.
|
||||
|
|
Loading…
Reference in New Issue