forked from OSchip/llvm-project
Fix formatting of fully qualified names in array subscripts.
Before: a[ :🅱️:c]; After: a[:🅱️:c]; llvm-svn: 258123
This commit is contained in:
parent
15f89c420b
commit
27f278186d
|
@ -2114,7 +2114,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
|
|||
if (Right.is(tok::coloncolon) && Left.isNot(tok::l_brace))
|
||||
return (Left.is(TT_TemplateOpener) &&
|
||||
Style.Standard == FormatStyle::LS_Cpp03) ||
|
||||
!(Left.isOneOf(tok::identifier, tok::l_paren, tok::r_paren) ||
|
||||
!(Left.isOneOf(tok::identifier, tok::l_paren, tok::r_paren,
|
||||
tok::l_square) ||
|
||||
Left.isOneOf(TT_TemplateCloser, TT_TemplateOpener));
|
||||
if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser)))
|
||||
return Style.SpacesInAngles;
|
||||
|
|
|
@ -6133,6 +6133,7 @@ TEST_F(FormatTest, FormatsArrays) {
|
|||
"aaaaaaaaaaa aaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaa->aaaaaaaaa[0]\n"
|
||||
" .aaaaaaa[0]\n"
|
||||
" .aaaaaaaaaaaaaaaaaaaaaa();");
|
||||
verifyFormat("a[::b::c];");
|
||||
|
||||
verifyNoCrash("a[,Y?)]", getLLVMStyleWithColumns(10));
|
||||
|
||||
|
|
Loading…
Reference in New Issue