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

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 18 11:08:55 PST 2015


djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Generally looks good.


================
Comment at: include/clang/Format/Format.h:166
@@ +165,3 @@
+  enum ReturnTypeBreakingStyle {
+    /// Break after return type automatically.
+    /// \c PenaltyReturnTypeOnItsOwnLine is taken into account.
----------------
Use tools/dump_format_style.py to update the documentation, too.

================
Comment at: include/clang/Format/Format.h:171
@@ +170,3 @@
+    RTBS_All,
+    /// Always break after the return types of top level functions.
+    RTBS_TopLevel,
----------------
nit: top-level

================
Comment at: lib/Format/TokenAnnotator.cpp:1642
@@ +1641,3 @@
+    if (!Current->MustBreakBefore && InFunctionDecl &&
+        Current->is(TT_FunctionDeclarationName)) {
+      Current->MustBreakBefore = mustBreakForReturnType(Line, *Current);
----------------
No braces, I think.

================
Comment at: lib/Format/TokenAnnotator.h:168
@@ -158,1 +167,3 @@
 
+  bool mustBreakForReturnType(const AnnotatedLine &Line,
+                              FormatToken &Token) const;
----------------
Some comment might help. E.g. at the very least, does that mean must break before or after "Token" (alternatively, name that Left or Right).


http://reviews.llvm.org/D10370





More information about the cfe-commits mailing list