diff options
author | Daniel Jasper <djasper@google.com> | 2013-09-10 10:26:38 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-09-10 10:26:38 +0000 |
commit | 71665cd1fdf281cfcbbe3a3f91623ddd50bf6551 (patch) | |
tree | 9dffb37f580cbfdf7de1def8f541dd552a06b536 /clang/lib | |
parent | a9eb9972e4183bc859d6daf16ab32b855c196f4e (diff) | |
download | bcm5719-llvm-71665cd1fdf281cfcbbe3a3f91623ddd50bf6551.tar.gz bcm5719-llvm-71665cd1fdf281cfcbbe3a3f91623ddd50bf6551.zip |
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
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 5 |
1 files changed, 5 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()) |