Don't format sizeof/alignof as function types.
Before: A<sizeof (*x)> a; After: A<sizeof(*x)> a; llvm-svn: 181764
This commit is contained in:
parent
9d987e34f7
commit
abc342148f
|
@ -173,7 +173,9 @@ private:
|
|||
}
|
||||
if (CurrentToken->isOneOf(tok::r_square, tok::r_brace))
|
||||
return false;
|
||||
if (CurrentToken->Parent->Type == TT_PointerOrReference &&
|
||||
if (Left->Parent &&
|
||||
!Left->Parent->isOneOf(tok::kw_sizeof, tok::kw_alignof) &&
|
||||
CurrentToken->Parent->Type == TT_PointerOrReference &&
|
||||
CurrentToken->Parent->Parent->isOneOf(tok::l_paren, tok::coloncolon))
|
||||
Left->DefinesFunctionType = true;
|
||||
updateParameterCount(Left, CurrentToken);
|
||||
|
|
|
@ -2790,6 +2790,10 @@ TEST_F(FormatTest, FormatsFunctionTypes) {
|
|||
|
||||
verifyGoogleFormat("A<void*(int*, SomeType*)>;");
|
||||
verifyGoogleFormat("void* (*a)(int);");
|
||||
|
||||
// Other constructs can look like function types:
|
||||
verifyFormat("A<sizeof(*x)> a;");
|
||||
verifyFormat("A<alignof(*x)> a;");
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, BreaksLongDeclarations) {
|
||||
|
|
Loading…
Reference in New Issue