[clang] [clang-format] Add SpacesInParensOption for filtering repeated parens (PR #77522)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Tue May 21 12:06:46 PDT 2024


================
@@ -4644,22 +4644,36 @@ struct FormatStyle {
   ///   # Should be declared this way:
   ///   SpacesInParens: Custom
   ///   SpacesInParensOptions:
+  ///     ExceptDoubleParentheses: false
   ///     InConditionalStatements: true
   ///     Other: true
   /// \endcode
   struct SpacesInParensCustom {
+    /// Override any of the following options to prevent addition of space
+    /// between the first two parentheses in situations where a pair of
+    /// parentheses have been used.
+    /// \code
+    ///   true:
+    ///   __attribute__(( noreturn ))
+    ///   __decltype__(( x ))
+    ///   if (( a = b ))
+    /// \endcode
+    ///  false:
+    ///    Uses the applicable option.
+    bool ExceptDoubleParentheses;
     /// Put a space in parentheses only inside conditional statements
     /// (``for/if/while/switch...``).
     /// \code
     ///    true:                                  false:
-    ///    if ( a )  { ... }              vs.     if (a) { ... }
+    ///    if ( ( a ) )  { ... }          vs.     if ((a)) { ... }
----------------
HazardyKnusperkeks wrote:

Don't change this.

If you want to show your option, adapt its documentation.

https://github.com/llvm/llvm-project/pull/77522


More information about the cfe-commits mailing list