================
@@ -5858,6 +5858,16 @@ TEST_F(FormatTest, RespectWhitespaceInMacroDefinitions) {
   verifyFormat("#define false((foo)0)", Style);
 }
 
+TEST_F(FormatTest, CompoundLiteralInMacroDefinition) {
+  // https://github.com/llvm/llvm-project/issues/173583
+  //
+  // A C compound literal `(type){...}` is not a function/block. When used in a
+  // macro definition, clang-format should not treat `&` as a function name and
+  // reformat it as if it were `&(type) { ... }`.
+  verifyFormat("#define getAddr(v, type) &(type){v}");
+  verifyFormat("#define ctos(c) (char[2]){c, '\\0'}");
+}
+
----------------
owenca wrote:

You can delete it as we don't add a `FormatTest` case when fixing a 
`TokenAnnotator` bug.

https://github.com/llvm/llvm-project/pull/173771
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to