[clang] [clang] Return std::optional from all Expr::tryEvaluate* API (PR #179230)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 5 07:38:40 PST 2026
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/179230 at github.com>
================
@@ -21659,18 +21659,25 @@ bool Expr::isPotentialConstantExprUnevaluated(Expr *E,
return Diags.empty();
}
-bool Expr::tryEvaluateObjectSize(uint64_t &Result, ASTContext &Ctx,
- unsigned Type) const {
+std::optional<uint64_t> Expr::tryEvaluateObjectSize(const ASTContext &Ctx,
+ unsigned Type) const {
if (!getType()->isPointerType())
return false;
Expr::EvalStatus Status;
EvalInfo Info(Ctx, Status, EvaluationMode::ConstantFold);
- if (Info.EnableNewConstInterp) {
- return Info.Ctx.getInterpContext().tryEvaluateObjectSize(Info, this, Type,
- Result);
- }
- return tryEvaluateBuiltinObjectSize(this, Type, Info, Result);
+ uint64_t Result = ~0u;
----------------
tbaederr wrote:
@Sirraide Is that alright?
https://github.com/llvm/llvm-project/pull/179230
More information about the cfe-commits
mailing list