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

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 25 22:51:57 PST 2024


================
@@ -4542,18 +4542,51 @@ struct FormatStyle {
   ///     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 of attribute specifiers.
+    /// \code
+    ///    true:
+    ///    __attribute__( ( noreturn ) )
+    /// \endcode
+    /// \code
+    ///    false:
+    ///    _attribute__((noreturn))
+    /// \endcode
+    bool InAttributeSpecifiers;
----------------
owenca wrote:

I still think this is too specific. It should be included in `Other` below.

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


More information about the cfe-commits mailing list