[clang] [clang-format] add an option to insert a space only for non-code block empty braces, not for empty parentheses (PR #93634)

Kohei Asano via cfe-commits cfe-commits at lists.llvm.org
Wed May 29 18:29:04 PDT 2024


================
@@ -6237,18 +6237,30 @@ the configuration (without a prefix: ``Auto``).
        true:                                  false:
        x = ( int32 )y                 vs.     x = (int32)y
 
-  * ``bool InEmptyParentheses`` Put a space in parentheses only if the parentheses are empty i.e. '()'
+  * ``bool InEmptyParentheses`` Put a space in parentheses and braces only if they are empty i.e. '()' or '{}'
----------------
khei4 wrote:

> it feels to me like InEmptyParentheses should be parenthese only

I totally agree with you, but it seems to break compatibility. I didn't know how such a change should land, but I'm eager to implement if it's ok to change that.

> InEmptyBraces should inherit by default from InEmptyParentheses if its not defined in the config?

That sounds reasonable and consistent. But that change would be non-functional and I can't find how I create inheritance of options appropriately. So if it's necessary, could you kindly tell me where inheritance should be placed? 🙏  

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


More information about the cfe-commits mailing list