Skip to content

Commit 35f273a

Browse files
authored
[clang][NFC] Clean up Expr::EvaluateAsConstantExpr (#130498)
The Info.EnableNewConstInterp case is already handled above.
1 parent 6e8d7e2 commit 35f273a

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
@@ -16903,24 +16903,19 @@ bool Expr::EvaluateAsConstantExpr(EvalResult &Result, const ASTContext &Ctx,
1690316903
APValue::LValueBase Base(&BaseMTE);
1690416904
Info.setEvaluatingDecl(Base, Result.Val);
1690516905

16906-
if (Info.EnableNewConstInterp) {
16907-
if (!Info.Ctx.getInterpContext().evaluateAsRValue(Info, this, Result.Val))
16908-
return false;
16909-
} else {
16910-
LValue LVal;
16911-
LVal.set(Base);
16912-
// C++23 [intro.execution]/p5
16913-
// A full-expression is [...] a constant-expression
16914-
// So we need to make sure temporary objects are destroyed after having
16915-
// evaluating the expression (per C++23 [class.temporary]/p4).
16916-
FullExpressionRAII Scope(Info);
16917-
if (!::EvaluateInPlace(Result.Val, Info, LVal, this) ||
16918-
Result.HasSideEffects || !Scope.destroy())
16919-
return false;
16906+
LValue LVal;
16907+
LVal.set(Base);
16908+
// C++23 [intro.execution]/p5
16909+
// A full-expression is [...] a constant-expression
16910+
// So we need to make sure temporary objects are destroyed after having
16911+
// evaluating the expression (per C++23 [class.temporary]/p4).
16912+
FullExpressionRAII Scope(Info);
16913+
if (!::EvaluateInPlace(Result.Val, Info, LVal, this) ||
16914+
Result.HasSideEffects || !Scope.destroy())
16915+
return false;
1692016916

16921-
if (!Info.discardCleanups())
16922-
llvm_unreachable("Unhandled cleanup; missing full expression marker?");
16923-
}
16917+
if (!Info.discardCleanups())
16918+
llvm_unreachable("Unhandled cleanup; missing full expression marker?");
1692416919

1692516920
if (!CheckConstantExpression(Info, getExprLoc(), getStorageType(Ctx, this),
1692616921
Result.Val, Kind))

0 commit comments

Comments
 (0)