[clang] 35f273a - [clang][NFC] Clean up Expr::EvaluateAsConstantExpr (#130498)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 10 00:56:27 PDT 2025
Author: Timm Baeder
Date: 2025-03-10T08:56:23+01:00
New Revision: 35f273ab07d9f1e65a662fb25a1aeebaba4552c2
URL: https://github.com/llvm/llvm-project/commit/35f273ab07d9f1e65a662fb25a1aeebaba4552c2
DIFF: https://github.com/llvm/llvm-project/commit/35f273ab07d9f1e65a662fb25a1aeebaba4552c2.diff
LOG: [clang][NFC] Clean up Expr::EvaluateAsConstantExpr (#130498)
The Info.EnableNewConstInterp case is already handled above.
Added:
Modified:
clang/lib/AST/ExprConstant.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 216bc478bb28b..4649cd79371f4 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -16903,24 +16903,19 @@ bool Expr::EvaluateAsConstantExpr(EvalResult &Result, const ASTContext &Ctx,
APValue::LValueBase Base(&BaseMTE);
Info.setEvaluatingDecl(Base, Result.Val);
- if (Info.EnableNewConstInterp) {
- if (!Info.Ctx.getInterpContext().evaluateAsRValue(Info, this, Result.Val))
- return false;
- } else {
- LValue LVal;
- LVal.set(Base);
- // C++23 [intro.execution]/p5
- // A full-expression is [...] a constant-expression
- // So we need to make sure temporary objects are destroyed after having
- // evaluating the expression (per C++23 [class.temporary]/p4).
- FullExpressionRAII Scope(Info);
- if (!::EvaluateInPlace(Result.Val, Info, LVal, this) ||
- Result.HasSideEffects || !Scope.destroy())
- return false;
+ LValue LVal;
+ LVal.set(Base);
+ // C++23 [intro.execution]/p5
+ // A full-expression is [...] a constant-expression
+ // So we need to make sure temporary objects are destroyed after having
+ // evaluating the expression (per C++23 [class.temporary]/p4).
+ FullExpressionRAII Scope(Info);
+ if (!::EvaluateInPlace(Result.Val, Info, LVal, this) ||
+ Result.HasSideEffects || !Scope.destroy())
+ return false;
- if (!Info.discardCleanups())
- llvm_unreachable("Unhandled cleanup; missing full expression marker?");
- }
+ if (!Info.discardCleanups())
+ llvm_unreachable("Unhandled cleanup; missing full expression marker?");
if (!CheckConstantExpression(Info, getExprLoc(), getStorageType(Ctx, this),
Result.Val, Kind))
More information about the cfe-commits
mailing list