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

omar ahmed via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 21 05:39:44 PDT 2022

omarahmed added inline comments.

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),
MyDeveloperDay wrote:
> HazardyKnusperkeks wrote:
> > As said in the other comment, there is code that depends on setting to never in the default constructor, so please do.
> Why Never and not Leave? basically introducing one or the other as a default won't that causes changes for people who don't want to use this?
I think that's a good point. I changed that to `APO_Leave` and added `APO_Never` to the code that depends on it. 

I was guarding the default behavior with `SpaceBeforeParentheses: Custom` condition but I think still if someone defined it to be custom and didn't specify this option, it should still be leave.

Comment at: clang/lib/Format/Format.cpp:1169
   case FormatStyle::SBPO_Never:
+    Expanded.SpaceBeforeParensOptions.AfterPlacementOperator = FormatStyle::SpaceBeforeParensCustom::APO_Never;
The part that depends on it to be `APO_Never` to align with `SBPO_Never` option.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list