summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-10-27 17:13:59 +0000
committerDaniel Jasper <djasper@google.com>2014-10-27 17:13:59 +0000
commite068ac77a223588faf7d80b36e516a656d9b52f6 (patch)
treedca3f80760afef6d7d22cf07f5ee6483364fdfa8 /clang/lib/Format
parent1f060a85526ac08fd23b46968fd97f75a2930030 (diff)
downloadbcm5719-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.cpp6
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;
}
OpenPOWER on IntegriCloud