[clang] [clang][ExprConst] Add early exit in `evaluateDestruction()` (PR #205476)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 23 21:12:08 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/205476.diff
1 Files Affected:
- (modified) clang/lib/AST/ExprConstant.cpp (+6)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/205476
More information about the cfe-commits
mailing list