Skip to content

Commit e957c9c

Browse files
committed
Remove unused getUsualDeleteParams function and update cast syntax in tests
1 parent 82cac01 commit e957c9c

File tree

2 files changed

+2
-56
lines changed

2 files changed

+2
-56
lines changed

clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -211,60 +211,6 @@ RValue CIRGenFunction::emitCXXMemberOrOperatorCall(
211211
return emitCall(fnInfo, callee, returnValue, args, nullptr, loc);
212212
}
213213

214-
namespace {
215-
/// The parameters to pass to a usual operator delete.
216-
struct UsualDeleteParams {
217-
TypeAwareAllocationMode typeAwareDelete = TypeAwareAllocationMode::No;
218-
bool destroyingDelete = false;
219-
bool size = false;
220-
AlignedAllocationMode alignment = AlignedAllocationMode::No;
221-
};
222-
} // namespace
223-
224-
// FIXME(cir): this should be shared with LLVM codegen
225-
static UsualDeleteParams getUsualDeleteParams(const FunctionDecl *fd) {
226-
UsualDeleteParams params;
227-
228-
const FunctionProtoType *fpt = fd->getType()->castAs<FunctionProtoType>();
229-
auto ai = fpt->param_type_begin(), ae = fpt->param_type_end();
230-
231-
if (fd->isTypeAwareOperatorNewOrDelete()) {
232-
params.typeAwareDelete = TypeAwareAllocationMode::Yes;
233-
assert(ai != ae);
234-
++ai;
235-
}
236-
237-
// The first argument after the type-identity parameter (if any) is
238-
// always a void* (or C* for a destroying operator delete for class
239-
// type C).
240-
++ai;
241-
242-
// The next parameter may be a std::destroying_delete_t.
243-
if (fd->isDestroyingOperatorDelete()) {
244-
params.destroyingDelete = true;
245-
assert(ai != ae);
246-
++ai;
247-
}
248-
249-
// Figure out what other parameters we should be implicitly passing.
250-
if (ai != ae && (*ai)->isIntegerType()) {
251-
params.size = true;
252-
++ai;
253-
} else {
254-
assert(!isTypeAwareAllocation(params.typeAwareDelete));
255-
}
256-
257-
if (ai != ae && (*ai)->isAlignValT()) {
258-
params.alignment = AlignedAllocationMode::Yes;
259-
++ai;
260-
} else {
261-
assert(!isTypeAwareAllocation(params.typeAwareDelete));
262-
}
263-
264-
assert(ai == ae && "unexpected usual deallocation function parameter");
265-
return params;
266-
}
267-
268214
static CharUnits calculateCookiePadding(CIRGenFunction &cgf,
269215
const CXXNewExpr *e) {
270216
if (!e->isArray())

clang/test/CIR/CodeGen/new.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ void t_new_constant_size() {
193193
// CHECK: %[[#NUM_ELEMENTS:]] = cir.const #cir.int<16> : !u64i
194194
// CHECK: %[[#ALLOCATION_SIZE:]] = cir.const #cir.int<128> : !u64i
195195
// CHECK: %[[RAW_PTR:.*]] = cir.call @_Znam(%[[#ALLOCATION_SIZE]]) : (!u64i) -> !cir.ptr<!void>
196-
// CHECK: %[[TYPED_PTR:.*]] = cir.cast(bitcast, %[[RAW_PTR]] : !cir.ptr<!void>), !cir.ptr<!cir.double>
196+
// CHECK: %[[TYPED_PTR:.*]] = cir.cast bitcast %[[RAW_PTR]] : !cir.ptr<!void> -> !cir.ptr<!cir.double>
197197
// CHECK: cir.store align(8) %[[TYPED_PTR]], %[[P_ADDR]] : !cir.ptr<!cir.double>, !cir.ptr<!cir.ptr<!cir.double>>
198198
// CHECK: cir.return
199199
// CHECK: }
@@ -220,7 +220,7 @@ void t_new_multidim_constant_size() {
220220
// CHECK: %[[#NUM_ELEMENTS:]] = cir.const #cir.int<24> : !u64i
221221
// CHECK: %[[#ALLOCATION_SIZE:]] = cir.const #cir.int<192> : !u64i
222222
// CHECK: %[[RAW_PTR:.*]] = cir.call @_Znam(%[[#ALLOCATION_SIZE]]) : (!u64i) -> !cir.ptr<!void>
223-
// CHECK: %[[TYPED_PTR:.*]] = cir.cast(bitcast, %[[RAW_PTR]] : !cir.ptr<!void>), !cir.ptr<!cir.array<!cir.array<!cir.double x 4> x 3>>
223+
// CHECK: %[[TYPED_PTR:.*]] = cir.cast bitcast %[[RAW_PTR]] : !cir.ptr<!void> -> !cir.ptr<!cir.array<!cir.array<!cir.double x 4> x 3>>
224224
// CHECK: cir.store align(8) %[[TYPED_PTR]], %[[P_ADDR]] : !cir.ptr<!cir.array<!cir.array<!cir.double x 4> x 3>>, !cir.ptr<!cir.ptr<!cir.array<!cir.array<!cir.double x 4> x 3>>>
225225
// CHECK: }
226226

0 commit comments

Comments
 (0)