[PATCH] D10370: clang-format: Implement AlwaysBreakAfterDeclarationReturnType.

Daniel Jasper djasper at google.com
Sun Jul 12 00:22:59 PDT 2015


djasper added inline comments.

================
Comment at: docs/ClangFormatStyleOptions.rst:221
@@ -220,2 +220,3 @@
 
-**AlwaysBreakAfterDefinitionReturnType** (``DefinitionReturnTypeBreakingStyle``)
+**AlwaysBreakAfterDeclarationReturnType** (``ReturnTypeBreakingStyle``)
+  The function declaration return type breaking style to use.
----------------
Do you think it'll ever make sense to break differently for declarations and definitions? I think having two entirely independent configuration flags gives us 9 combinations (assuming the three enum values will remain) out of which many will never be used.

I see two alternatives:
Add an additional bool flag "TreatDeclarationsLikeDefinitions" (name might not be ideal yet).
Change existing flag name to AlwaysBreakAfterReturnType and use five enum values (None, TopLevel, All, TopLevelDefinitions, AllDefinitions).

What do you think?

Sorry for being very picky on this. The problem is that these options stick around for a long time and we need to think about them carefully.

================
Comment at: lib/Format/ContinuationIndenter.cpp:129-132
@@ -128,5 +128,6 @@
   if (Current.is(TT_FunctionDeclarationName) &&
       Style.AlwaysBreakAfterDefinitionReturnType == FormatStyle::DRTBS_None &&
+      Style.AlwaysBreakAfterDeclarationReturnType == FormatStyle::DRTBS_None &&
       State.Column < 6)
     return false;
 
----------------
What do you mean exactly?


http://reviews.llvm.org/D10370







More information about the cfe-commits mailing list