diff options
| author | Daniel Jasper <djasper@google.com> | 2014-08-05 12:16:31 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2014-08-05 12:16:31 +0000 |
| commit | ca4ea1ce595867f2bdcf204064193c36eb242937 (patch) | |
| tree | 10e2c54bb3bab286cef6c3893e1757716803edfc /clang/lib/Format/TokenAnnotator.cpp | |
| parent | d9670878d46372e402f67372361cd408f98c54ef (diff) | |
| download | bcm5719-llvm-ca4ea1ce595867f2bdcf204064193c36eb242937.tar.gz bcm5719-llvm-ca4ea1ce595867f2bdcf204064193c36eb242937.zip | |
clang-format: Add option to always break after a function's return type.
This is required for GNU coding style, among others.
Also update the configuration documentation.
Modified from an original patch by Jarkko Hietaniemi, thank you!
llvm-svn: 214858
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
| -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 0d7e6bfbcb8..ed6938fdbc8 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1288,6 +1288,11 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) { Current->MustBreakBefore = Current->MustBreakBefore || mustBreakBefore(Line, *Current); + if (Style.AlwaysBreakAfterDefinitionReturnType && + InFunctionDecl && Current->Type == TT_FunctionDeclarationName && + Line.Last->is(tok::l_brace)) // Only for definitions. + Current->MustBreakBefore = true; + Current->CanBreakBefore = Current->MustBreakBefore || canBreakBefore(Line, *Current); unsigned ChildSize = 0; |

