[PATCH] Support GNU style rule to put a space before opening parenthesis.

Alexander Kornienko alexfh at google.com
Tue Dec 10 02:36:09 PST 2013



================
Comment at: include/clang/Format/Format.h:260
@@ +259,3 @@
+  /// \brief Different ways to put a space before opening parentheses.
+  enum SpaceBeforeParensKind {
+    /// Never put a space before opening parentheses.
----------------
Daniel Jasper wrote:
> nit: ..Kind does not quite feel right (although I might be wrong). How about ..Options?
Options sounds good. Done.

================
Comment at: include/clang/Format/Format.h:266
@@ +265,3 @@
+    SBPK_ControlStatements,
+    /// Put a space before opening parentheses always, except when it's
+    /// prohibited by the syntax rules (in function-like macro definitions) or
----------------
Daniel Jasper wrote:
> nit: Move "always" to the beginning.
Done.

================
Comment at: include/clang/Format/Format.h:273
@@ +272,3 @@
+
+  /// \brief Defines, in which cases to put a space before opening parentheses.
+  SpaceBeforeParensKind SpaceBeforeParens;
----------------
Daniel Jasper wrote:
> nit: No comma.
Done.

================
Comment at: lib/Format/Format.cpp:100
@@ +99,3 @@
+    IO.enumCase(Value, "Never", clang::format::FormatStyle::SBPK_Never);
+    IO.enumCase(Value, "false", clang::format::FormatStyle::SBPK_Never);
+    IO.enumCase(Value, "ControlStatements",
----------------
Daniel Jasper wrote:
> Put "true" and "false" next to each other and add:
> 
>    // For backward compatibility.
> 
> I think soon-ish we'll need to come up with a way to version config files and enable breaking changes.
Done.


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



More information about the cfe-commits mailing list