[PATCH] D43047: [Builtins] Overload __builtin_operator_new/delete to accept an optional alignment parameter.
Eric Fiselier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 7 18:29:50 PST 2018
EricWF marked an inline comment as done.
EricWF added inline comments.
================
Comment at: lib/CodeGen/CGExprCXX.cpp:1309-1344
RValue CodeGenFunction::EmitBuiltinNewDeleteCall(const FunctionProtoType *Type,
- const Expr *Arg,
- bool IsDelete) {
+ const Expr *E, bool IsDelete) {
+ const auto *TheCall = dyn_cast<CallExpr>(E);
+ llvm::SmallVector<QualType, 2> ArgTypes;
+ for (auto *Arg : TheCall->arguments())
+ ArgTypes.push_back(Arg->getType());
CallArgList Args;
----------------
rsmith wrote:
> Can we leave this code alone and set the builtin expression's type to exactly match the type of the chosen function? I really don't want to be special-casing aligned allocation here. (This change should also cover sized delete and any future extensions to builtin operator new/delete.)
That doesn't seem possible as you describe it. Both overloads of the builtin operator share the same `FunctionDecl`, and we can't change the type of that decl to match the selected operator for a particular call.
I think checking the argument types is the best way to proceed. However, I'll change the types of the call expression to exactly match the types of the selected `operator new/delete`, which will at least clean this up some.
https://reviews.llvm.org/D43047
More information about the cfe-commits
mailing list