forked from OSchip/llvm-project
clang-format: Fix unary operator recognition.
Before: int x = ~ * p; After: int x = ~*p; llvm-svn: 214070
This commit is contained in:
parent
8b76d608b8
commit
2ac3fdfd4a
|
@ -755,7 +755,7 @@ private:
|
||||||
Contexts.back().CaretFound = true;
|
Contexts.back().CaretFound = true;
|
||||||
} else if (Current.isOneOf(tok::minusminus, tok::plusplus)) {
|
} else if (Current.isOneOf(tok::minusminus, tok::plusplus)) {
|
||||||
Current.Type = determineIncrementUsage(Current);
|
Current.Type = determineIncrementUsage(Current);
|
||||||
} else if (Current.is(tok::exclaim)) {
|
} else if (Current.isOneOf(tok::exclaim, tok::tilde)) {
|
||||||
Current.Type = TT_UnaryOperator;
|
Current.Type = TT_UnaryOperator;
|
||||||
} else if (Current.is(tok::question)) {
|
} else if (Current.is(tok::question)) {
|
||||||
Current.Type = TT_ConditionalExpr;
|
Current.Type = TT_ConditionalExpr;
|
||||||
|
|
|
@ -4766,6 +4766,7 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
|
||||||
verifyIndependentOfContext("typedef void (*f)(int *a);");
|
verifyIndependentOfContext("typedef void (*f)(int *a);");
|
||||||
verifyIndependentOfContext("int i{a * b};");
|
verifyIndependentOfContext("int i{a * b};");
|
||||||
verifyIndependentOfContext("aaa && aaa->f();");
|
verifyIndependentOfContext("aaa && aaa->f();");
|
||||||
|
verifyIndependentOfContext("int x = ~*p;");
|
||||||
|
|
||||||
verifyIndependentOfContext("InvalidRegions[*R] = 0;");
|
verifyIndependentOfContext("InvalidRegions[*R] = 0;");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue