[clang] [Clang] omit parentheses in fold expressions with a single expansion (PR #110761)

via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 6 02:00:47 PDT 2024


================
@@ -2171,10 +2171,15 @@ class ParenExpr : public Expr {
   SourceLocation L, R;
   Stmt *Val;
 public:
+  enum TransformConstraint : uint8_t {
+    None = 0,     // No specific preservation required
+    Preserve = 1, // Parentheses have always to be preserved
+  };
+
----------------
cor3ntin wrote:

I'm not sure that we need an enum here, i guess me and @erichkeane disagree!
Either way we should try to minimize the memory footprint of this feature.
One way to do that would be to introduce a `ParenExprBitFiled` in Stmt.h

You will also need to modify AstStmtReader / AstStmtWriter to make sure that gets serialized

I think the name should probably be something like "ProducedByFoldExpansion".

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


More information about the cfe-commits mailing list