================
@@ -2206,6 +2206,55 @@ static unsigned computePointerOffset(const ASTContext
&ASTCtx,
return Result;
}
+/// __builtin_assume_dereferenceable(Ptr, Size)
+static bool interp__builtin_assume_dereferenceable(InterpState &S, CodePtr
OpPC,
+ const InterpFrame *Frame,
+ const CallExpr *Call) {
+ assert(Call->getNumArgs() == 2);
+
+ APSInt ReqSize = popToAPSInt(S, Call->getArg(1));
+ const Pointer &Ptr = S.Stk.pop<Pointer>();
+
+ if (ReqSize.isZero())
+ return true;
+ if (Ptr.isZero()) {
+ S.FFDiag(S.Current->getSource(OpPC), diag::note_constexpr_access_null)
+ << AK_Read << S.Current->getRange(OpPC);
+ return false;
+ }
+ if (!Ptr.isBlockPointer()) {
+ if (Ptr.isIntegralPointer())
----------------
tbaederr wrote:
That if can go away now.
https://github.com/llvm/llvm-project/pull/169869
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits