diff options
| author | Daniel Jasper <djasper@google.com> | 2013-09-27 08:29:16 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-09-27 08:29:16 +0000 |
| commit | f3167903b84fc9f7f6350b758c6ab9f4a7b12874 (patch) | |
| tree | a6b2eff964c6d029a19eeed951fcdbad922f69d3 /clang/lib/Format | |
| parent | 68c880b5f9f95c1225338905ae63a5487b118f15 (diff) | |
| download | bcm5719-llvm-f3167903b84fc9f7f6350b758c6ab9f4a7b12874.tar.gz bcm5719-llvm-f3167903b84fc9f7f6350b758c6ab9f4a7b12874.zip | |
clang-format: Improve formatting of functions with multiple trailing tokens.
Before:
void SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaa) override
final;
After:
void SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaa) override final;
llvm-svn: 191494
Diffstat (limited to 'clang/lib/Format')
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index e1e4f79d177..992104fe4c2 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -606,7 +606,10 @@ private: } if (Current.Type == TT_Unknown) { - if (isStartOfName(Current)) { + // 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) { Contexts.back().FirstStartOfName = &Current; Current.Type = TT_StartOfName; NameFound = true; |

