forked from OSchip/llvm-project
clang-format: Understand function type typedefs with typeof.
Before: typedef typeof(int(int, int)) * MyFunc; After: typedef typeof(int(int, int)) *MyFunc; This fixes llvm.org/PR17178. llvm-svn: 190401
This commit is contained in:
parent
a9eb9972e4
commit
71665cd1fd
|
@ -745,6 +745,11 @@ private:
|
|||
if (NextToken->is(tok::l_square))
|
||||
return TT_PointerOrReference;
|
||||
|
||||
if (PrevToken->is(tok::r_paren) && PrevToken->MatchingParen &&
|
||||
PrevToken->MatchingParen->Previous &&
|
||||
PrevToken->MatchingParen->Previous->is(tok::kw_typeof))
|
||||
return TT_PointerOrReference;
|
||||
|
||||
if (PrevToken->Tok.isLiteral() ||
|
||||
PrevToken->isOneOf(tok::r_paren, tok::r_square) ||
|
||||
NextToken->Tok.isLiteral() || NextToken->isUnaryOperator())
|
||||
|
|
|
@ -3765,6 +3765,7 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
|
|||
verifyIndependentOfContext("Type **A = static_cast<Type **>(P);");
|
||||
verifyGoogleFormat("Type** A = static_cast<Type**>(P);");
|
||||
verifyFormat("auto a = [](int **&, int ***) {};");
|
||||
verifyFormat("typedef typeof(int(int, int)) *MyFunc;");
|
||||
|
||||
verifyIndependentOfContext("InvalidRegions[*R] = 0;");
|
||||
|
||||
|
|
Loading…
Reference in New Issue