While for <<-operators often used in log statments, a single key value
pair is always on the second operator, e.g.
llvm::errs() << "aaaaa=" << aaaaa;
It is on the first operator for plus- or comma-concatenated strings:
string s = "
aaaaaaaaaa: " +
aaaaaaaa;
(the "=" not counting because that's a different operator precedence)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290177
91177308-0d34-0410-b5e6-
96231b3b80d8
if (Left.isOneOf(tok::plus, tok::comma) && Left.Previous &&
Left.Previous->isLabelString() &&
- (Left.NextOperator || Left.OperatorIndex != 1))
+ (Left.NextOperator || Left.OperatorIndex != 0))
return 100;
+ if (Right.is(tok::plus) && Left.isLabelString() &&
+ (Right.NextOperator || Right.OperatorIndex != 0))
+ return 25;
if (Left.is(tok::comma))
return 1;
- if (Right.isOneOf(tok::lessless, tok::plus) && Left.isLabelString() &&
+ if (Right.is(tok::lessless) && Left.isLabelString() &&
(Right.NextOperator || Right.OperatorIndex != 1))
return 25;
if (Right.is(tok::lessless)) {
verifyFormat("string v = StrCat(\"aaaaaaaaaaaaaaaa: \", aaaaaaaaaaaaaaaa,\n"
" \"aaaaaaaaaaaaaaaa: \", aaaaaaaaaaaaaaaa,\n"
" \"aaaaaaaaaaaaaaaa: \", aaaaaaaaaaaaaaaa);");
+ verifyFormat("string v = \"aaaaaaaaaaaaaaaa: \" +\n"
+ " (aaaa + aaaa);",
+ getLLVMStyleWithColumns(40));
+ verifyFormat("string v = StrCat(\"aaaaaaaaaaaa: \" +\n"
+ " (aaaaaaa + aaaaa));",
+ getLLVMStyleWithColumns(40));
}
TEST_F(FormatTest, UnderstandsEquals) {