From 71665cd1fdf281cfcbbe3a3f91623ddd50bf6551 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Tue, 10 Sep 2013 10:26:38 +0000 Subject: 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 --- clang/lib/Format/TokenAnnotator.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib') 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()) -- cgit v1.2.3