[PATCH] D120608: [Clang] Remove redundant init-parens in AST print

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 28 10:23:58 PST 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/StmtPrinter.cpp:2155
 
-  CXXNewExpr::InitializationStyle InitStyle = E->getInitializationStyle();
-  if (InitStyle) {
-    if (InitStyle == CXXNewExpr::CallInit)
+  auto InitStyle = E->getInitializationStyle();
+  if (InitStyle != CXXNewExpr::NoInit) {
----------------
lichray wrote:
> aaron.ballman wrote:
> > You should still spell out the type as it's not spelled out in the initialization.
> In this piece of code, I got "`CXXNewExpr`," "`InitializationStyle`", "`::`" -- every morpheme needed to derive the type "`CXXNewExpr::InitializationStyle`," so I guess it's clear enough.
> 
I don't want to hold anything up over this, but the usual rule of thumb is "in the initialization" so that we don't have to hunt around to other code to figure out the type.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120608



More information about the cfe-commits mailing list