forked from OSchip/llvm-project
clang-format: Improve *-detection.
Before: S << a *(10); After: S << a * (10); This fixes llvm.org/PR16500. llvm-svn: 237690
This commit is contained in:
parent
c8cd58fa26
commit
9310166a63
|
@ -825,6 +825,9 @@ private:
|
||||||
Previous->Type = TT_PointerOrReference;
|
Previous->Type = TT_PointerOrReference;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (Current.is(tok::lessless) &&
|
||||||
|
(!Current.Previous || !Current.Previous->is(tok::kw_operator))) {
|
||||||
|
Contexts.back().IsExpression = true;
|
||||||
} else if (Current.isOneOf(tok::kw_return, tok::kw_throw)) {
|
} else if (Current.isOneOf(tok::kw_return, tok::kw_throw)) {
|
||||||
Contexts.back().IsExpression = true;
|
Contexts.back().IsExpression = true;
|
||||||
} else if (Current.is(TT_TrailingReturnArrow)) {
|
} else if (Current.is(TT_TrailingReturnArrow)) {
|
||||||
|
|
|
@ -5468,6 +5468,8 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
|
||||||
verifyIndependentOfContext("int a = *b;");
|
verifyIndependentOfContext("int a = *b;");
|
||||||
verifyIndependentOfContext("int a = *b * c;");
|
verifyIndependentOfContext("int a = *b * c;");
|
||||||
verifyIndependentOfContext("int a = b * *c;");
|
verifyIndependentOfContext("int a = b * *c;");
|
||||||
|
verifyIndependentOfContext("int a = b * (10);");
|
||||||
|
verifyIndependentOfContext("S << b * (10);");
|
||||||
verifyIndependentOfContext("return 10 * b;");
|
verifyIndependentOfContext("return 10 * b;");
|
||||||
verifyIndependentOfContext("return *b * *c;");
|
verifyIndependentOfContext("return *b * *c;");
|
||||||
verifyIndependentOfContext("return a & ~b;");
|
verifyIndependentOfContext("return a & ~b;");
|
||||||
|
|
Loading…
Reference in New Issue