[clang] [Clang] Instantiate functions from constant evaluation. (PR #205557)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 18 18:49:22 PDT 2026
================
@@ -21964,11 +22000,23 @@ bool Expr::EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx,
assert(!isValueDependent() &&
"Expression evaluator can't be called on a dependent expression.");
ExprTimeTraceScope TimeScope(this, Ctx, "EvaluateAsRValue");
- EvalInfo Info(Ctx, Result, EvaluationMode::IgnoreSideEffects);
+ EvalInfo Info(Ctx, /*Sema=*/nullptr, Result,
+ EvaluationMode::IgnoreSideEffects);
Info.InConstantContext = InConstantContext;
return ::EvaluateAsRValue(this, Result, Ctx, Info);
}
+bool Expr::EvaluateAsMandatedConstantRValue(EvalResult &Result,
----------------
shafik wrote:
I am not crazy that this is `Expr::EvaluateAsRValue` w/ some minor modifications. Duplicated code are always bug magnets and we should avoid them if possible.
Maybe we can created a private member they both call?
https://github.com/llvm/llvm-project/pull/205557
More information about the cfe-commits
mailing list