[clang] [RFC] Initial implementation of P2719 (PR #113510)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 1 22:48:34 PDT 2025
================
@@ -1466,17 +1477,30 @@ namespace {
void Emit(CodeGenFunction &CGF, Flags flags) override {
const auto *FPT = OperatorDelete->getType()->castAs<FunctionProtoType>();
CallArgList DeleteArgs;
-
- // The first argument is always a void* (or C* for a destroying operator
- // delete for class type C).
- DeleteArgs.add(Traits::get(CGF, Ptr), FPT->getParamType(0));
+ unsigned FirstNonTypeArg = 0;
+ TypeAwareAllocationMode TypeAwareDeallocation =
+ TypeAwareAllocationMode::No;
+ if (OperatorDelete->isTypeAwareOperatorNewOrDelete()) {
+ TypeAwareDeallocation = TypeAwareAllocationMode::Yes;
+ QualType SpecializedTypeIdentity = FPT->getParamType(0);
+ ++FirstNonTypeArg;
+ CXXScalarValueInitExpr TypeIdentityParam(SpecializedTypeIdentity,
+ nullptr, SourceLocation());
+ DeleteArgs.add(CGF.EmitAnyExprToTemp(&TypeIdentityParam),
+ SpecializedTypeIdentity);
+ }
+ // The first non type tag argument is always a void* (or C* for a
----------------
ojhunt wrote:
done and actually saved the comment change this time
<!-- Reviewable comment -OMp-wwi3ZaYOl6j0fZs:bv02yzj -->
<!-- Sent from Reviewable.io -->
https://github.com/llvm/llvm-project/pull/113510
More information about the cfe-commits
mailing list