forked from OSchip/llvm-project
clang-format: Improve <<-formatting.
This fixes a regression caused by r186115. Before: Diag(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbb) << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; After: Diag(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbb) << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; llvm-svn: 186164
This commit is contained in:
parent
764d8d3d6f
commit
77d5d31320
|
@ -1174,6 +1174,11 @@ private:
|
||||||
State.Stack.back().BreakBeforeParameter)
|
State.Stack.back().BreakBeforeParameter)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
// Same as above, but for the first "<<" operator.
|
||||||
|
if (Current.is(tok::lessless) && State.Stack.back().BreakBeforeParameter &&
|
||||||
|
State.Stack.back().FirstLessLess == 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
// FIXME: Comparing LongestObjCSelectorName to 0 is a hacky way of finding
|
// FIXME: Comparing LongestObjCSelectorName to 0 is a hacky way of finding
|
||||||
// out whether it is the first parameter. Clean this up.
|
// out whether it is the first parameter. Clean this up.
|
||||||
if (Current.Type == TT_ObjCSelectorName &&
|
if (Current.Type == TT_ObjCSelectorName &&
|
||||||
|
|
|
@ -3026,6 +3026,11 @@ TEST_F(FormatTest, AlignsPipes) {
|
||||||
" << aaaaaaaaaaaaaaaaaaaaaaaaaaaa;",
|
" << aaaaaaaaaaaaaaaaaaaaaaaaaaaa;",
|
||||||
getLLVMStyleWithColumns(70));
|
getLLVMStyleWithColumns(70));
|
||||||
|
|
||||||
|
// But sometimes, breaking before the first "<<" is necessary.
|
||||||
|
verifyFormat("Diag(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbb)\n"
|
||||||
|
" << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
||||||
|
" << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;");
|
||||||
|
|
||||||
verifyFormat(
|
verifyFormat(
|
||||||
"llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
"llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
||||||
" .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();");
|
" .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();");
|
||||||
|
|
Loading…
Reference in New Issue