[PATCH] D149514: Check if First argument in _builtin_assume_aligned_ is of pointer type
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 1 14:21:28 PDT 2023
rsmith added a comment.
There's some corresponding code in `lib/CodeGen` that can be deleted too:
case Builtin::BI__builtin_assume_aligned: {
const Expr *Ptr = E->getArg(0);
Value *PtrValue = EmitScalarExpr(Ptr);
- if (PtrValue->getType() != VoidPtrTy)
- PtrValue = EmitCastToVoidPtr(PtrValue);
Value *OffsetValue =
(E->getNumArgs() > 2) ? EmitScalarExpr(E->getArg(2)) : nullptr;
================
Comment at: clang/lib/Sema/SemaChecking.cpp:7979-7986
{
ExprResult FirstArgResult =
DefaultFunctionArrayLvalueConversion(FirstArg);
- if (FirstArgResult.isInvalid())
+ if (checkBuiltinArgument(*this, TheCall, 0))
return true;
+ /// In-place updation of FirstArg by checkBuiltinArgument is ignored.
TheCall->setArg(0, FirstArgResult.get());
----------------
This still seems to be more complex than necessary. If we can't just do this, we should have a comment explaining why. (Eg, does CodeGen really want the final conversion from `T*` to `const void*` to not be in the AST?)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149514/new/
https://reviews.llvm.org/D149514
More information about the cfe-commits
mailing list