@@ -153,28 +153,6 @@ static void dtorArrayDesc(Block *B, std::byte *Ptr, const Descriptor *D) {
153
153
}
154
154
}
155
155
156
- static void moveArrayDesc (Block *B, std::byte *Src, std::byte *Dst,
157
- const Descriptor *D) {
158
- const unsigned NumElems = D->getNumElems ();
159
- const unsigned ElemSize =
160
- D->ElemDesc ->getAllocSize () + sizeof (InlineDescriptor);
161
-
162
- unsigned ElemOffset = 0 ;
163
- for (unsigned I = 0 ; I < NumElems; ++I, ElemOffset += ElemSize) {
164
- auto *SrcPtr = Src + ElemOffset;
165
- auto *DstPtr = Dst + ElemOffset;
166
-
167
- auto *SrcDesc = reinterpret_cast <InlineDescriptor *>(SrcPtr);
168
- auto *SrcElemLoc = reinterpret_cast <std::byte *>(SrcDesc + 1 );
169
- auto *DstDesc = reinterpret_cast <InlineDescriptor *>(DstPtr);
170
- auto *DstElemLoc = reinterpret_cast <std::byte *>(DstDesc + 1 );
171
-
172
- *DstDesc = *SrcDesc;
173
- if (auto Fn = D->ElemDesc ->MoveFn )
174
- Fn (B, SrcElemLoc, DstElemLoc, D->ElemDesc );
175
- }
176
- }
177
-
178
156
static void initField (Block *B, std::byte *Ptr, bool IsConst, bool IsMutable,
179
157
bool IsVolatile, bool IsActive, bool IsUnionField,
180
158
bool InUnion, const Descriptor *D, unsigned FieldOffset) {
@@ -268,45 +246,6 @@ static void dtorRecord(Block *B, std::byte *Ptr, const Descriptor *D) {
268
246
destroyBase (B, Ptr, F.Desc , F.Offset );
269
247
}
270
248
271
- static void moveRecord (Block *B, std::byte *Src, std::byte *Dst,
272
- const Descriptor *D) {
273
- assert (D);
274
- assert (D->ElemRecord );
275
-
276
- // FIXME: Code duplication.
277
- for (const auto &F : D->ElemRecord ->fields ()) {
278
- auto FieldOffset = F.Offset ;
279
- const auto *SrcDesc =
280
- reinterpret_cast <const InlineDescriptor *>(Src + FieldOffset) - 1 ;
281
- auto *DestDesc =
282
- reinterpret_cast <InlineDescriptor *>(Dst + FieldOffset) - 1 ;
283
- std::memcpy (DestDesc, SrcDesc, sizeof (InlineDescriptor));
284
-
285
- if (auto Fn = F.Desc ->MoveFn )
286
- Fn (B, Src + FieldOffset, Dst + FieldOffset, F.Desc );
287
- }
288
-
289
- for (const auto &Base : D->ElemRecord ->bases ()) {
290
- auto BaseOffset = Base.Offset ;
291
- const auto *SrcDesc =
292
- reinterpret_cast <const InlineDescriptor *>(Src + BaseOffset) - 1 ;
293
- auto *DestDesc = reinterpret_cast <InlineDescriptor *>(Dst + BaseOffset) - 1 ;
294
- std::memcpy (DestDesc, SrcDesc, sizeof (InlineDescriptor));
295
-
296
- if (auto Fn = Base.Desc ->MoveFn )
297
- Fn (B, Src + BaseOffset, Dst + BaseOffset, Base.Desc );
298
- }
299
-
300
- for (const auto &VBase : D->ElemRecord ->virtual_bases ()) {
301
- auto VBaseOffset = VBase.Offset ;
302
- const auto *SrcDesc =
303
- reinterpret_cast <const InlineDescriptor *>(Src + VBaseOffset) - 1 ;
304
- auto *DestDesc =
305
- reinterpret_cast <InlineDescriptor *>(Dst + VBaseOffset) - 1 ;
306
- std::memcpy (DestDesc, SrcDesc, sizeof (InlineDescriptor));
307
- }
308
- }
309
-
310
249
static BlockCtorFn getCtorPrim (PrimType Type) {
311
250
// Floating types are special. They are primitives, but need their
312
251
// constructor called.
@@ -337,18 +276,6 @@ static BlockDtorFn getDtorPrim(PrimType Type) {
337
276
COMPOSITE_TYPE_SWITCH (Type, return dtorTy<T>, return nullptr );
338
277
}
339
278
340
- static BlockMoveFn getMovePrim (PrimType Type) {
341
- if (Type == PT_Float)
342
- return moveTy<PrimConv<PT_Float>::T>;
343
- if (Type == PT_IntAP)
344
- return moveTy<PrimConv<PT_IntAP>::T>;
345
- if (Type == PT_IntAPS)
346
- return moveTy<PrimConv<PT_IntAPS>::T>;
347
- if (Type == PT_MemberPtr)
348
- return moveTy<PrimConv<PT_MemberPtr>::T>;
349
- COMPOSITE_TYPE_SWITCH (Type, return moveTy<T>, return nullptr );
350
- }
351
-
352
279
static BlockCtorFn getCtorArrayPrim (PrimType Type) {
353
280
TYPE_SWITCH (Type, return ctorArrayTy<T>);
354
281
llvm_unreachable (" unknown Expr" );
@@ -359,11 +286,6 @@ static BlockDtorFn getDtorArrayPrim(PrimType Type) {
359
286
llvm_unreachable (" unknown Expr" );
360
287
}
361
288
362
- static BlockMoveFn getMoveArrayPrim (PrimType Type) {
363
- TYPE_SWITCH (Type, return moveArrayTy<T>);
364
- llvm_unreachable (" unknown Expr" );
365
- }
366
-
367
289
// / Primitives.
368
290
Descriptor::Descriptor (const DeclTy &D, const Type *SourceTy, PrimType Type,
369
291
MetadataSize MD, bool IsConst, bool IsTemporary,
@@ -372,7 +294,7 @@ Descriptor::Descriptor(const DeclTy &D, const Type *SourceTy, PrimType Type,
372
294
MDSize(MD.value_or(0 )), AllocSize(align(Size + MDSize)), PrimT(Type),
373
295
IsConst(IsConst), IsMutable(IsMutable), IsTemporary(IsTemporary),
374
296
IsVolatile(IsVolatile), CtorFn(getCtorPrim(Type)),
375
- DtorFn(getDtorPrim(Type)), MoveFn(getMovePrim(Type)) {
297
+ DtorFn(getDtorPrim(Type)) {
376
298
assert (AllocSize >= Size);
377
299
assert (Source && " Missing source" );
378
300
}
@@ -386,7 +308,7 @@ Descriptor::Descriptor(const DeclTy &D, PrimType Type, MetadataSize MD,
386
308
AllocSize(align(MDSize) + align(Size) + sizeof(InitMapPtr)), PrimT(Type),
387
309
IsConst(IsConst), IsMutable(IsMutable), IsTemporary(IsTemporary),
388
310
IsArray(true ), CtorFn(getCtorArrayPrim(Type)),
389
- DtorFn(getDtorArrayPrim(Type)), MoveFn(getMoveArrayPrim(Type)) {
311
+ DtorFn(getDtorArrayPrim(Type)) {
390
312
assert (Source && " Missing source" );
391
313
assert (NumElems <= (MaxArrayElemBytes / ElemSize));
392
314
}
@@ -399,7 +321,7 @@ Descriptor::Descriptor(const DeclTy &D, PrimType Type, MetadataSize MD,
399
321
AllocSize(MDSize + sizeof (InitMapPtr) + alignof(void *)), PrimT(Type),
400
322
IsConst(IsConst), IsMutable(false ), IsTemporary(IsTemporary),
401
323
IsArray(true ), CtorFn(getCtorArrayPrim(Type)),
402
- DtorFn(getDtorArrayPrim(Type)), MoveFn(getMoveArrayPrim(Type)) {
324
+ DtorFn(getDtorArrayPrim(Type)) {
403
325
assert (Source && " Missing source" );
404
326
}
405
327
@@ -414,7 +336,7 @@ Descriptor::Descriptor(const DeclTy &D, const Type *SourceTy,
414
336
AllocSize(std::max<size_t >(alignof (void *), Size) + MDSize),
415
337
ElemDesc(Elem), IsConst(IsConst), IsMutable(IsMutable),
416
338
IsTemporary(IsTemporary), IsArray(true ), CtorFn(ctorArrayDesc),
417
- DtorFn(dtorArrayDesc), MoveFn(moveArrayDesc) {
339
+ DtorFn(dtorArrayDesc) {
418
340
assert (Source && " Missing source" );
419
341
}
420
342
@@ -425,7 +347,7 @@ Descriptor::Descriptor(const DeclTy &D, const Descriptor *Elem, MetadataSize MD,
425
347
Size(UnknownSizeMark), MDSize(MD.value_or(0 )),
426
348
AllocSize(MDSize + alignof (void *)), ElemDesc(Elem), IsConst(true ),
427
349
IsMutable(false ), IsTemporary(IsTemporary), IsArray(true ),
428
- CtorFn(ctorArrayDesc), DtorFn(dtorArrayDesc), MoveFn(moveArrayDesc) {
350
+ CtorFn(ctorArrayDesc), DtorFn(dtorArrayDesc) {
429
351
assert (Source && " Missing source" );
430
352
}
431
353
@@ -437,7 +359,7 @@ Descriptor::Descriptor(const DeclTy &D, const Record *R, MetadataSize MD,
437
359
Size(ElemSize), MDSize(MD.value_or(0 )), AllocSize(Size + MDSize),
438
360
ElemRecord(R), IsConst(IsConst), IsMutable(IsMutable),
439
361
IsTemporary(IsTemporary), IsVolatile(IsVolatile), CtorFn(ctorRecord),
440
- DtorFn(dtorRecord), MoveFn(moveRecord) {
362
+ DtorFn(dtorRecord) {
441
363
assert (Source && " Missing source" );
442
364
}
443
365
0 commit comments