diff options
| author | Daniel Jasper <djasper@google.com> | 2014-10-27 17:13:59 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2014-10-27 17:13:59 +0000 |
| commit | e068ac77a223588faf7d80b36e516a656d9b52f6 (patch) | |
| tree | dca3f80760afef6d7d22cf07f5ee6483364fdfa8 /clang/lib/Format | |
| parent | 1f060a85526ac08fd23b46968fd97f75a2930030 (diff) | |
| download | bcm5719-llvm-e068ac77a223588faf7d80b36e516a656d9b52f6.tar.gz bcm5719-llvm-e068ac77a223588faf7d80b36e516a656d9b52f6.zip | |
clang-format: Don't break after very short return types.
Before:
void
SomeFunction(int parameter);
After:
void SomeFunction(
int parameter);
(Unless AlwaysBreakAfterDefinitionReturnType after type is set).
llvm-svn: 220686
Diffstat (limited to 'clang/lib/Format')
| -rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 82dffd6fff5..a6fb40ece7a 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -122,6 +122,12 @@ bool ContinuationIndenter::canBreak(const LineState &State) { State.Stack[State.Stack.size() - 2].HasMultipleNestedBlocks) return false; + // Don't break after very short return types (e.g. "void") as that is often + // unexpected. + if (Current.Type == TT_FunctionDeclarationName && + !Style.AlwaysBreakAfterDefinitionReturnType && State.Column < 6) + return false; + return !State.Stack.back().NoLineBreak; } |

