forked from OSchip/llvm-project
clang-format: Support chained dereferenced assignments.
Before: x = * a(x) = *a(y); After: x = *a(x) = *a(y); llvm-svn: 215632
This commit is contained in:
parent
78b4533acf
commit
1904e9b98d
|
@ -708,7 +708,8 @@ private:
|
|||
}
|
||||
if ((Previous->Type == TT_BinaryOperator ||
|
||||
Previous->Type == TT_UnaryOperator) &&
|
||||
Previous->isOneOf(tok::star, tok::amp)) {
|
||||
Previous->isOneOf(tok::star, tok::amp) && Previous->Previous &&
|
||||
Previous->Previous->isNot(tok::equal)) {
|
||||
Previous->Type = TT_PointerOrReference;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4823,6 +4823,10 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
|
|||
"const char* const p = reinterpret_cast<const char* const>(q);");
|
||||
verifyGoogleFormat("void f(int i = 0, SomeType** temps = NULL);");
|
||||
|
||||
FormatStyle Left = getLLVMStyle();
|
||||
Left.PointerAlignment = FormatStyle::PAS_Left;
|
||||
verifyFormat("x = *a(x) = *a(y);", Left);
|
||||
|
||||
verifyIndependentOfContext("a = *(x + y);");
|
||||
verifyIndependentOfContext("a = &(x + y);");
|
||||
verifyIndependentOfContext("*(x + y).call();");
|
||||
|
|
Loading…
Reference in New Issue