@@ -280,53 +280,6 @@ class DWARFFieldDescriptorImpl : public swift::reflection::FieldDescriptorBase {
280
280
return payload_fields;
281
281
}
282
282
};
283
-
284
- class DWARFMultiPayloadEnumDescriptorImpl
285
- : public swift::reflection::MultiPayloadEnumDescriptorBase {
286
- ConstString m_mangled_name;
287
- DIERef m_die_ref;
288
- std::vector<uint8_t > m_spare_bits_mask;
289
- uint64_t m_byte_offset;
290
-
291
- public:
292
- ~DWARFMultiPayloadEnumDescriptorImpl () override = default ;
293
-
294
- DWARFMultiPayloadEnumDescriptorImpl (ConstString mangled_name, DIERef die_ref,
295
- std::vector<uint8_t > &&spare_bits_mask,
296
- uint64_t byte_offset)
297
- : swift::reflection::MultiPayloadEnumDescriptorBase(),
298
- m_mangled_name (mangled_name), m_die_ref(die_ref),
299
- m_spare_bits_mask(std::move(spare_bits_mask)),
300
- m_byte_offset(byte_offset) {}
301
-
302
- llvm::StringRef getMangledTypeName () override {
303
- return m_mangled_name.GetStringRef ();
304
- }
305
-
306
- uint32_t getContentsSizeInWords () const override {
307
- return m_spare_bits_mask.size () / 4 ;
308
- }
309
-
310
- size_t getSizeInBytes () const override { return m_spare_bits_mask.size (); }
311
-
312
- uint32_t getFlags () const override { return usesPayloadSpareBits (); }
313
-
314
- bool usesPayloadSpareBits () const override {
315
- return !m_spare_bits_mask.empty ();
316
- }
317
-
318
- uint32_t getPayloadSpareBitMaskByteOffset () const override {
319
- return m_byte_offset;
320
- }
321
-
322
- uint32_t getPayloadSpareBitMaskByteCount () const override {
323
- return getSizeInBytes ();
324
- }
325
-
326
- const uint8_t *getPayloadSpareBits () const override {
327
- return m_spare_bits_mask.data ();
328
- }
329
- };
330
283
} // namespace
331
284
332
285
// / Constructs a builtin type descriptor from DWARF information.
@@ -377,80 +330,8 @@ DWARFASTParserSwift::getBuiltinTypeDescriptor(
377
330
std::unique_ptr<swift::reflection::MultiPayloadEnumDescriptorBase>
378
331
DWARFASTParserSwift::getMultiPayloadEnumDescriptor (
379
332
const swift::reflection::TypeRef *TR) {
380
- assert (ModuleList::GetGlobalModuleListProperties ()
381
- .GetSwiftEnableFullDwarfDebugging () !=
382
- lldb_private::AutoBool::False &&
383
- " Full DWARF debugging for Swift is disabled!" );
384
-
385
- auto pair = getTypeAndDie (m_swift_typesystem, TR);
386
- if (!pair)
387
- return nullptr ;
388
-
389
- auto [type, die] = *pair;
390
- if (!die)
391
- return nullptr ;
392
-
393
- auto kind = getFieldDescriptorKindForDie (type);
394
- if (!kind)
395
- return nullptr ;
396
-
397
- auto child_die = die.GetFirstChild ();
398
- auto bit_offset =
399
- child_die.GetAttributeValueAsUnsigned (llvm::dwarf::DW_AT_bit_offset, 0 );
400
-
401
- auto byte_offset = (bit_offset + 7 ) / 8 ;
402
-
403
- const auto &attributes = child_die.GetAttributes ();
404
- auto spare_bits_mask_idx =
405
- attributes.FindAttributeIndex (llvm::dwarf::DW_AT_APPLE_spare_bits_mask);
406
- if (spare_bits_mask_idx == UINT32_MAX)
407
- return nullptr ;
408
-
409
- DWARFFormValue form_value;
410
- attributes.ExtractFormValueAtIndex (spare_bits_mask_idx, form_value);
411
-
412
- if (!form_value.IsValid ()) {
413
- if (auto *log = GetLog (LLDBLog::Types)) {
414
- std::stringstream ss;
415
- TR->dump (ss);
416
- LLDB_LOG (log,
417
- " Could not produce MultiPayloadEnumTypeInfo for typeref: {0}" ,
418
- ss.str ());
419
- }
420
- return nullptr ;
421
- }
422
- // If there's a block data, this is a number bigger than 64 bits already
423
- // encoded as an array.
424
- if (form_value.BlockData ()) {
425
- uint64_t block_length = form_value.Unsigned ();
426
- std::vector<uint8_t > bytes (form_value.BlockData (),
427
- form_value.BlockData () + block_length);
428
- return std::make_unique<DWARFMultiPayloadEnumDescriptorImpl>(
429
- type.GetMangledTypeName (), *die.GetDIERef (),
430
- std::move (bytes), byte_offset);
431
- }
432
-
433
- // If there is no block data, the spare bits mask is encoded as a single 64
434
- // bit number. Convert this to a byte array with only the amount of bytes
435
- // necessary to cover the whole number (see
436
- // MultiPayloadEnumDescriptorBuilder::layout on GenReflection.cpp for a
437
- // similar calculation when emitting this into metadata).
438
- llvm::APInt bits (64 , form_value.Unsigned ());
439
- auto bitsInMask = bits.getActiveBits ();
440
- uint32_t bytesInMask = (bitsInMask + 7 ) / 8 ;
441
- auto wordsInMask = (bytesInMask + 3 ) / 4 ;
442
- bits = bits.zextOrTrunc (wordsInMask * 32 );
443
-
444
- std::vector<uint8_t > bytes;
445
- for (size_t i = 0 ; i < bytesInMask; ++i) {
446
- uint8_t byte = bits.extractBitsAsZExtValue (8 , 0 );
447
- bytes.push_back (byte);
448
- bits.lshrInPlace (8 );
449
- }
450
-
451
- return std::make_unique<DWARFMultiPayloadEnumDescriptorImpl>(
452
- type.GetMangledTypeName (), *die.GetDIERef (), std::move (bytes),
453
- byte_offset);
333
+ // Remote mirrors is able to calculate type information without needing a MultiPayloadEnumDescriptor.
334
+ return nullptr ;
454
335
}
455
336
456
337
namespace {
0 commit comments