@@ -210,60 +210,6 @@ RValue CIRGenFunction::emitCXXMemberOrOperatorCall(
210
210
return emitCall (fnInfo, callee, returnValue, args, nullptr , loc);
211
211
}
212
212
213
- namespace {
214
- // / The parameters to pass to a usual operator delete.
215
- struct UsualDeleteParams {
216
- TypeAwareAllocationMode typeAwareDelete = TypeAwareAllocationMode::No;
217
- bool destroyingDelete = false ;
218
- bool size = false ;
219
- AlignedAllocationMode alignment = AlignedAllocationMode::No;
220
- };
221
- } // namespace
222
-
223
- // FIXME(cir): this should be shared with LLVM codegen
224
- static UsualDeleteParams getUsualDeleteParams (const FunctionDecl *fd) {
225
- UsualDeleteParams params;
226
-
227
- const FunctionProtoType *fpt = fd->getType ()->castAs <FunctionProtoType>();
228
- auto ai = fpt->param_type_begin (), ae = fpt->param_type_end ();
229
-
230
- if (fd->isTypeAwareOperatorNewOrDelete ()) {
231
- params.typeAwareDelete = TypeAwareAllocationMode::Yes;
232
- assert (ai != ae);
233
- ++ai;
234
- }
235
-
236
- // The first argument after the type-identity parameter (if any) is
237
- // always a void* (or C* for a destroying operator delete for class
238
- // type C).
239
- ++ai;
240
-
241
- // The next parameter may be a std::destroying_delete_t.
242
- if (fd->isDestroyingOperatorDelete ()) {
243
- params.destroyingDelete = true ;
244
- assert (ai != ae);
245
- ++ai;
246
- }
247
-
248
- // Figure out what other parameters we should be implicitly passing.
249
- if (ai != ae && (*ai)->isIntegerType ()) {
250
- params.size = true ;
251
- ++ai;
252
- } else {
253
- assert (!isTypeAwareAllocation (params.typeAwareDelete ));
254
- }
255
-
256
- if (ai != ae && (*ai)->isAlignValT ()) {
257
- params.alignment = AlignedAllocationMode::Yes;
258
- ++ai;
259
- } else {
260
- assert (!isTypeAwareAllocation (params.typeAwareDelete ));
261
- }
262
-
263
- assert (ai == ae && " unexpected usual deallocation function parameter" );
264
- return params;
265
- }
266
-
267
213
static mlir::Value emitCXXNewAllocSize (CIRGenFunction &cgf, const CXXNewExpr *e,
268
214
unsigned minElements,
269
215
mlir::Value &numElements,
@@ -616,11 +562,11 @@ void CIRGenFunction::emitDeleteCall(const FunctionDecl *deleteFD,
616
562
const auto *deleteFTy = deleteFD->getType ()->castAs <FunctionProtoType>();
617
563
CallArgList deleteArgs;
618
564
619
- UsualDeleteParams params = getUsualDeleteParams (deleteFD );
565
+ UsualDeleteParams params = deleteFD-> getUsualDeleteParams ();
620
566
auto paramTypeIt = deleteFTy->param_type_begin ();
621
567
622
568
// Pass std::type_identity tag if present
623
- if (isTypeAwareAllocation (params.typeAwareDelete ))
569
+ if (isTypeAwareAllocation (params.TypeAwareDelete ))
624
570
cgm.errorNYI (deleteFD->getSourceRange (),
625
571
" emitDeleteCall: type aware delete" );
626
572
@@ -631,12 +577,12 @@ void CIRGenFunction::emitDeleteCall(const FunctionDecl *deleteFD,
631
577
deleteArgs.add (RValue::get (deletePtr), argTy);
632
578
633
579
// Pass the std::destroying_delete tag if present.
634
- if (params.destroyingDelete )
580
+ if (params.DestroyingDelete )
635
581
cgm.errorNYI (deleteFD->getSourceRange (),
636
582
" emitDeleteCall: destroying delete" );
637
583
638
584
// Pass the size if the delete function has a size_t parameter.
639
- if (params.size ) {
585
+ if (params.Size ) {
640
586
QualType sizeType = *paramTypeIt++;
641
587
CharUnits deleteTypeSize = getContext ().getTypeSizeInChars (deleteTy);
642
588
assert (mlir::isa<cir::IntType>(convertType (sizeType)) &&
@@ -648,7 +594,7 @@ void CIRGenFunction::emitDeleteCall(const FunctionDecl *deleteFD,
648
594
}
649
595
650
596
// Pass the alignment if the delete function has an align_val_t parameter.
651
- if (isAlignedAllocation (params.alignment ))
597
+ if (isAlignedAllocation (params.Alignment ))
652
598
cgm.errorNYI (deleteFD->getSourceRange (),
653
599
" emitDeleteCall: aligned allocation" );
654
600
0 commit comments