Skip to content

Commit c3a736f

Browse files
committed
[clang][NFC] Clean up Expr::EvaluateAsConstantExpr
The Info.EnableNewConstInterp case is already handled above.
1 parent 107aa6a commit c3a736f

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

clang/lib/AST/ExprConstant.cpp

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16892,24 +16892,19 @@ bool Expr::EvaluateAsConstantExpr(EvalResult &Result, const ASTContext &Ctx,
1689216892
APValue::LValueBase Base(&BaseMTE);
1689316893
Info.setEvaluatingDecl(Base, Result.Val);
1689416894

16895-
if (Info.EnableNewConstInterp) {
16896-
if (!Info.Ctx.getInterpContext().evaluateAsRValue(Info, this, Result.Val))
16897-
return false;
16898-
} else {
16899-
LValue LVal;
16900-
LVal.set(Base);
16901-
// C++23 [intro.execution]/p5
16902-
// A full-expression is [...] a constant-expression
16903-
// So we need to make sure temporary objects are destroyed after having
16904-
// evaluating the expression (per C++23 [class.temporary]/p4).
16905-
FullExpressionRAII Scope(Info);
16906-
if (!::EvaluateInPlace(Result.Val, Info, LVal, this) ||
16907-
Result.HasSideEffects || !Scope.destroy())
16908-
return false;
16895+
LValue LVal;
16896+
LVal.set(Base);
16897+
// C++23 [intro.execution]/p5
16898+
// A full-expression is [...] a constant-expression
16899+
// So we need to make sure temporary objects are destroyed after having
16900+
// evaluating the expression (per C++23 [class.temporary]/p4).
16901+
FullExpressionRAII Scope(Info);
16902+
if (!::EvaluateInPlace(Result.Val, Info, LVal, this) ||
16903+
Result.HasSideEffects || !Scope.destroy())
16904+
return false;
1690916905

16910-
if (!Info.discardCleanups())
16911-
llvm_unreachable("Unhandled cleanup; missing full expression marker?");
16912-
}
16906+
if (!Info.discardCleanups())
16907+
llvm_unreachable("Unhandled cleanup; missing full expression marker?");
1691316908

1691416909
if (!CheckConstantExpression(Info, getExprLoc(), getStorageType(Ctx, this),
1691516910
Result.Val, Kind))

0 commit comments

Comments
 (0)