[clang] [Clang] Diagnose invalid object size kinds during constant evaluation (PR #230979)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 12 02:37:44 PDT 2026
================
@@ -17176,10 +17176,13 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
case Builtin::BI__builtin_dynamic_object_size:
case Builtin::BI__builtin_object_size: {
- // The type was checked when we built the expression.
- unsigned Type =
- E->getArg(1)->EvaluateKnownConstInt(Info.Ctx).getZExtValue();
- assert(Type <= 3 && "unexpected type");
+ APSInt TypeValue = E->getArg(1)->EvaluateKnownConstInt(Info.Ctx);
----------------
keepyixiao wrote:
Thanks for pointing this out. I will handle the unevaluable argument case in
a follow-up PR and track it in #231108.
https://github.com/llvm/llvm-project/pull/230979
More information about the cfe-commits
mailing list