diff options
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 5 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index c0897ca68cb..d9aef602d3f 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -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()) diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 8ae956e4fd2..a27d193cb19 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -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;"); |