[PATCH] Add some options related to inserting spaces around parentheses

Daniel Jasper djasper at google.com
Mon Aug 19 00:00:28 PDT 2013


  Thanks for working on this!


================
Comment at: include/clang/Format/Format.h:196
@@ -195,1 +195,3 @@
   bool IndentFunctionDeclarationAfterType;

+  /// \brief If true, spaces will be inserted after every '(' and before every
+  /// ')'.
----------------
Add an empty line.

================
Comment at: include/clang/Format/Format.h:201
@@ +200,3 @@
+  /// \brief If false, spaces may be inserted into '()'.
+  bool NoSpaceInEmptyParentheses;
+
----------------
I think we should aim for independent configuration options as much as possible.

So, how about making this "SpaceInEmptyParentheses" and letting it control "f()" independent of "SpacesInParentheses"?

================
Comment at: include/clang/Format/Format.h:204
@@ +203,3 @@
+  /// \brief If false, spaces may be inserted into C style casts.
+  bool NoSpacesInCStyleCastParentheses;
+
----------------
Same as above. I'd prefer this as "SpacesInCStyleCastParentheses" and have this control "(int)1.0" independent of spaces in other parentheses.

================
Comment at: unittests/Format/FormatTest.cpp:5524
@@ +5523,3 @@
+  verifyFormat("call()", Spaces);
+
+}
----------------
nit: Remove empty line.

================
Comment at: unittests/Format/FormatTest.cpp:5767
@@ -5695,1 +5766,3 @@
+  CHECK_PARSE_BOOL(NoSpaceInEmptyParentheses);
+  CHECK_PARSE_BOOL(SpaceAfterControlStatementKeyword);
   CHECK_PARSE("AccessModifierOffset: -1234", AccessModifierOffset, -1234);
----------------
This does not seem right? Is the patch synced to the latest revision?


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



More information about the cfe-commits mailing list