[PATCH] D127270: [clang-format] Add space in placement new expression

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 16 12:39:38 PDT 2022


HazardyKnusperkeks added inline comments.


================
Comment at: clang/include/clang/Format/Format.h:3495
+    /// \code
+    ///    true:                                  false:
+    ///    new (buf) T;                    vs.    new(buf) T;
----------------
MyDeveloperDay wrote:
> should this be `Always/Never`
Nope, this should be removed. :)


================
Comment at: clang/include/clang/Format/Format.h:3559
           AfterFunctionDefinitionName(false), AfterIfMacros(false),
-          AfterOverloadedOperator(false), AfterRequiresInClause(false),
-          AfterRequiresInExpression(false), BeforeNonEmptyParentheses(false) {}
+          AfterOverloadedOperator(false), AfterPlacementOperator(APO_Always),
+          AfterRequiresInClause(false), AfterRequiresInExpression(false),
----------------
As said in the other comment, there is code that depends on setting to never in the default constructor, so please do.


================
Comment at: clang/unittests/Format/FormatTest.cpp:10142
+  verifyFormat("T *p = new (buf) T(3);", AfterPlacementOperator);
+  verifyFormat("T *p = delete (buf)T(3);", AfterPlacementOperator);
+  verifyFormat("struct A {\n"
----------------
Can this be valid code?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127270/new/

https://reviews.llvm.org/D127270



More information about the cfe-commits mailing list