[clang] [Clang][AST] {CXXDefaultArgExpr, CXXDefaultInitExpr}::hasRewrittenInit return true iff the init expression was really rebuild (PR #99748)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 26 09:26:55 PDT 2024


================
@@ -1013,15 +1013,15 @@ CXXDefaultArgExpr *CXXDefaultArgExpr::CreateEmpty(const ASTContext &C,
   return new (Mem) CXXDefaultArgExpr(EmptyShell(), HasRewrittenInit);
 }
 
-CXXDefaultArgExpr *CXXDefaultArgExpr::Create(const ASTContext &C,
-                                             SourceLocation Loc,
-                                             ParmVarDecl *Param,
-                                             Expr *RewrittenExpr,
-                                             DeclContext *UsedContext) {
+CXXDefaultArgExpr *
+CXXDefaultArgExpr::Create(const ASTContext &C, SourceLocation Loc,
+                          ParmVarDecl *Param, DeclContext *UsedContext,
+                          Expr *RewrittenExpr, bool HasRewrittenInit) {
   size_t Size = totalSizeToAlloc<Expr *>(RewrittenExpr != nullptr);
----------------
Sirraide wrote:

Maybe the naming here is just weird, but is there ever a case where `RewrittenExpr != nullptr` and `HasRewrittenInit` *don’t* evaluated to the same value? Because in that case, either `HasRewrittenInit` seems superfluous or `RewrittenExpr` is badly named, because a ‘non-rewritten `RewrittenExpr`’ sounds a bit nonsensical...

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


More information about the cfe-commits mailing list