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

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 23 16:36:50 PDT 2024


================
@@ -17125,6 +17125,23 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
   verifyFormat("SomeType *__attribute__((attr)) *a = NULL;", Spaces);
   verifyFormat("void __attribute__((naked)) foo(int bar)", Spaces);
   verifyFormat("void f() __attribute__((asdf));", Spaces);
+  verifyFormat("x = (int32)y;", Spaces);
+  verifyFormat("y = ((int (*)(int))foo)(x);", Spaces);
+  verifyFormat("decltype(x) y = 42;", Spaces);
+  verifyFormat("decltype((x)) y = z;", Spaces);
+  verifyFormat("decltype((foo())) a = foo();", Spaces);
+  verifyFormat("decltype((bar(10))) a = bar(11);", Spaces);
+  verifyFormat("if ((x - y) && (a ^ b))\n"
+               "  f();\n",
----------------
owenca wrote:

No newline at the end of test cases.

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


More information about the cfe-commits mailing list