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;
----------------
EricWF wrote:
> 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.
Nevermind... I see what you meant. I can set the `Callee` type and not the type 
of the `CalleeDecl`.


https://reviews.llvm.org/D43047



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to