[clang] [clang][ExprConst] Add early exit in `evaluateDestruction()` (PR #205476)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 23 21:11:35 PDT 2026
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/205476
There's nothing to do here for them. It's a little sad that we still crated the vector holding the notes int he caller but setting `HasConstantDestruction` is a side-effect of `evaluateDestruction()` that some callers rely on.
>From 9fc9d46216271476b9ec20057e1f3b911ef96140 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Wed, 24 Jun 2026 06:05:40 +0200
Subject: [PATCH] [clang][ExprConst] Add early exit in `evaluateDestruction()`
---
clang/lib/AST/ExprConstant.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index dde3b8bab43ec..a0558f2ac9d99 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -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;
+ }
+
Expr::EvalStatus EStatus;
EStatus.Diag = &Notes;
More information about the cfe-commits
mailing list