[clang] [clang-format] Fix clang-format issue with 'new' and 'delete' keywords in C files (PR #85470)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 18 09:42:34 PDT 2024


================
@@ -11450,6 +11450,11 @@ TEST_F(FormatTest, UnderstandsNewAndDelete) {
                "void new (link p);\n"
                "void delete (link p);");
 
+  verifyFormat("{ p->delete(); }\n"
+               "{ p->new(); }",
+               "{ p->delete (); }\n"
+               "{ p->new (); }");
----------------
scythris wrote:

Thank you for the comment @owenca 

Changing the order makes sense.

But if the changes to `TokenAnnotator::spaceRequiredBetween` are reverted, the test without braces will not fail. That is why I included them. But it's not really clear to me why they are needed.

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


More information about the cfe-commits mailing list