[clang] [clang][ExprConst] Add early exit in `evaluateDestruction()` (PR #205476)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 24 08:04:13 PDT 2026


================
@@ -21707,6 +21707,12 @@ bool Expr::EvaluateAsInitializer(const ASTContext &Ctx, const VarDecl *VD,
 
 bool VarDecl::evaluateDestruction(
     SmallVectorImpl<PartialDiagnosticAt> &Notes) const {
+
+  if (getType()->isPointerOrReferenceType()) {
+    ensureEvaluatedStmt()->HasConstantDestruction = true;
+    return true;
+  }
+
----------------
cor3ntin wrote:

can we short circuit for anything that is not a class type?

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


More information about the cfe-commits mailing list