forked from OSchip/llvm-project
Improve formatting of operator<< chains.
Before: llvm::outs() << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa; After: llvm::outs() << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa; llvm-svn: 186320
This commit is contained in:
parent
cacb40c6c7
commit
0d5e44df3c
|
@ -127,7 +127,7 @@ namespace format {
|
||||||
|
|
||||||
void setDefaultPenalties(FormatStyle &Style) {
|
void setDefaultPenalties(FormatStyle &Style) {
|
||||||
Style.PenaltyBreakComment = 45;
|
Style.PenaltyBreakComment = 45;
|
||||||
Style.PenaltyBreakFirstLessLess = 100;
|
Style.PenaltyBreakFirstLessLess = 180;
|
||||||
Style.PenaltyBreakString = 1000;
|
Style.PenaltyBreakString = 1000;
|
||||||
Style.PenaltyExcessCharacter = 1000000;
|
Style.PenaltyExcessCharacter = 1000000;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1082,7 +1082,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
|
||||||
Content = Content.drop_back(1).drop_front(1).trim();
|
Content = Content.drop_back(1).drop_front(1).trim();
|
||||||
if (Content.size() > 1 &&
|
if (Content.size() > 1 &&
|
||||||
(Content.back() == ':' || Content.back() == '='))
|
(Content.back() == ':' || Content.back() == '='))
|
||||||
return 20;
|
return 50;
|
||||||
}
|
}
|
||||||
return prec::Shift;
|
return prec::Shift;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2999,6 +2999,9 @@ TEST_F(FormatTest, AlignsPipes) {
|
||||||
" << \" ddd = [\" << pkt.ddd << \"]\\n\"\n"
|
" << \" ddd = [\" << pkt.ddd << \"]\\n\"\n"
|
||||||
" << \"}\";");
|
" << \"}\";");
|
||||||
|
|
||||||
|
verifyFormat("llvm::outs() << \"aaaaaaaaaaaaaaaa: \" << aaaaaaaaaaaaaaaa\n"
|
||||||
|
" << \"aaaaaaaaaaaaaaaa: \" << aaaaaaaaaaaaaaaa\n"
|
||||||
|
" << \"aaaaaaaaaaaaaaaa: \" << aaaaaaaaaaaaaaaa;");
|
||||||
verifyFormat(
|
verifyFormat(
|
||||||
"llvm::outs() << \"aaaaaaaaaaaaaaaaa = \" << aaaaaaaaaaaaaaaaa\n"
|
"llvm::outs() << \"aaaaaaaaaaaaaaaaa = \" << aaaaaaaaaaaaaaaaa\n"
|
||||||
" << \"bbbbbbbbbbbbbbbbb = \" << bbbbbbbbbbbbbbbbb\n"
|
" << \"bbbbbbbbbbbbbbbbb = \" << bbbbbbbbbbbbbbbbb\n"
|
||||||
|
|
Loading…
Reference in New Issue