[clang] [Clang] Make __builtin_assume_dereferenceable constexpr (PR #169869)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 16 08:26:45 PST 2025
================
@@ -20055,6 +20055,46 @@ class VoidExprEvaluator
// The argument is not evaluated!
return true;
+ case Builtin::BI__builtin_assume_dereferenceable: {
+ assert(E->getType()->isVoidType());
+ assert(E->getNumArgs() == 2);
+
+ APSInt ReqSizeVal;
+ if (!::EvaluateInteger(E->getArg(1), ReqSizeVal, Info))
+ return false;
+ if (ReqSizeVal.isZero())
+ return true;
+
+ LValue Pointer;
+ if (!EvaluatePointer(E->getArg(0), Pointer, Info)) {
+ if (EvaluateBuiltinConstantP(Info, E->getArg(0)))
----------------
tbaederr wrote:
I don't understand how the quote related to the `EvaluateBuiltinConstantP()` call. The check simly seems unnecessary.
https://github.com/llvm/llvm-project/pull/169869
More information about the cfe-commits
mailing list