[PATCH] Added an option to allow short function bodies be placed on a single line.

Manuel Klimek klimek at google.com
Wed Nov 20 06:53:45 PST 2013



================
Comment at: lib/Format/Format.cpp:421
@@ +420,3 @@
+        Style.BreakBeforeBraces != FormatStyle::BS_Attach) {
+      Limit = Limit > 3 ? Limit - 3 : 0;
+      unsigned MergedLines = 0;
----------------
Why 3? (please add a comment).

================
Comment at: lib/Format/Format.cpp:426
@@ +425,3 @@
+        if (MergedLines > 0)
+          ++MergedLines;
+      }
----------------
I assume this is because we also slurp in the { on the single line?

================
Comment at: lib/Format/Format.cpp:439
@@ +438,3 @@
+                 : 0;
+    }
+    if (TheLine->InPPDirective &&
----------------
Which test breaks that needed the change from an if () {} else if () {} ... return 0; to doing the check within each if?


http://llvm-reviews.chandlerc.com/D2230



More information about the cfe-commits mailing list