summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-08-14 10:52:56 +0000
committerDaniel Jasper <djasper@google.com>2014-08-14 10:52:56 +0000
commit78b4533acfd23a8944d0b5d3510e13b79a36805f (patch)
tree56e49c6a9db1d2f19a545962817729f0faf22a6e /clang/lib/Format/TokenAnnotator.cpp
parent0d64b20c037dfc09debb4f6fb753d122f46a6dd6 (diff)
downloadbcm5719-llvm-78b4533acfd23a8944d0b5d3510e13b79a36805f.tar.gz
bcm5719-llvm-78b4533acfd23a8944d0b5d3510e13b79a36805f.zip
clang-format: Support breaking arguments of function type typedefs.
Before: typedef size_t (*aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)( const aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa *aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: typedef size_t (*aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)( const aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); llvm-svn: 215631
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 90988301611..133c53521b2 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -639,9 +639,9 @@ private:
void next() {
if (CurrentToken) {
- determineTokenType(*CurrentToken);
- CurrentToken->BindingStrength = Contexts.back().BindingStrength;
CurrentToken->NestingLevel = Contexts.size() - 1;
+ CurrentToken->BindingStrength = Contexts.back().BindingStrength;
+ determineTokenType(*CurrentToken);
CurrentToken = CurrentToken->Next;
}
@@ -745,7 +745,8 @@ private:
// Line.MightBeFunctionDecl can only be true after the parentheses of a
// function declaration have been found. In this case, 'Current' is a
// trailing token of this declaration and thus cannot be a name.
- if (isStartOfName(Current) && !Line.MightBeFunctionDecl) {
+ if (isStartOfName(Current) &&
+ (!Line.MightBeFunctionDecl || Current.NestingLevel != 0)) {
Contexts.back().FirstStartOfName = &Current;
Current.Type = TT_StartOfName;
} else if (Current.is(tok::kw_auto)) {
OpenPOWER on IntegriCloud