@@ -70,10 +70,11 @@ class FieldRecordFlags {
70
70
71
71
class FieldRecord {
72
72
const FieldRecordFlags Flags;
73
+
74
+ public:
73
75
const RelativeDirectPointer<const char > MangledTypeName;
74
76
const RelativeDirectPointer<const char > FieldName;
75
77
76
- public:
77
78
FieldRecord () = delete ;
78
79
79
80
bool hasMangledTypeName () const {
@@ -84,11 +85,8 @@ class FieldRecord {
84
85
return Demangle::makeSymbolicMangledNameStringRef (MangledTypeName.get ());
85
86
}
86
87
87
- StringRef getFieldName (uintptr_t Low, uintptr_t High) const {
88
- uintptr_t nameAddr = (uintptr_t )FieldName.get ();
89
- if (nameAddr < Low || nameAddr > High)
90
- return " " ;
91
- return (const char *)nameAddr;
88
+ StringRef getFieldName () const {
89
+ return FieldName.get ();
92
90
}
93
91
94
92
bool isIndirectCase () const {
@@ -162,10 +160,10 @@ class FieldDescriptor {
162
160
return reinterpret_cast <const FieldRecord *>(this + 1 );
163
161
}
164
162
163
+ public:
165
164
const RelativeDirectPointer<const char > MangledTypeName;
166
165
const RelativeDirectPointer<const char > Superclass;
167
166
168
- public:
169
167
FieldDescriptor () = delete ;
170
168
171
169
const FieldDescriptorKind Kind;
@@ -227,46 +225,13 @@ class FieldDescriptor {
227
225
}
228
226
};
229
227
230
- class FieldDescriptorIterator
231
- : public std::iterator<std::forward_iterator_tag, FieldDescriptor> {
232
- public:
233
- const void *Cur;
234
- const void * const End;
235
- FieldDescriptorIterator (const void *Cur, const void * const End)
236
- : Cur(Cur), End(End) {}
237
-
238
- const FieldDescriptor &operator *() const {
239
- return *reinterpret_cast <const FieldDescriptor *>(Cur);
240
- }
241
-
242
- const FieldDescriptor *operator ->() const {
243
- return reinterpret_cast <const FieldDescriptor *>(Cur);
244
- }
245
-
246
- FieldDescriptorIterator &operator ++() {
247
- const auto &FR = this ->operator *();
248
- const void *Next = reinterpret_cast <const char *>(Cur)
249
- + sizeof (FieldDescriptor) + FR.NumFields * FR.FieldRecordSize ;
250
- Cur = Next;
251
- return *this ;
252
- }
253
-
254
- bool operator ==(FieldDescriptorIterator const &other) const {
255
- return Cur == other.Cur && End == other.End ;
256
- }
257
-
258
- bool operator !=(FieldDescriptorIterator const &other) const {
259
- return !(*this == other);
260
- }
261
- };
262
-
263
228
// Associated type records describe the mapping from an associated
264
229
// type to the type witness of a conformance.
265
230
class AssociatedTypeRecord {
231
+ public:
266
232
const RelativeDirectPointer<const char > Name;
267
233
const RelativeDirectPointer<const char > SubstitutedTypeName;
268
234
269
- public:
270
235
StringRef getName () const {
271
236
return Name.get ();
272
237
}
@@ -322,10 +287,9 @@ struct AssociatedTypeRecordIterator {
322
287
// An associated type descriptor contains a collection of associated
323
288
// type records for a conformance.
324
289
struct AssociatedTypeDescriptor {
325
- private :
290
+ public :
326
291
const RelativeDirectPointer<const char > ConformingTypeName;
327
292
const RelativeDirectPointer<const char > ProtocolTypeName;
328
- public:
329
293
330
294
uint32_t NumAssociatedTypes;
331
295
uint32_t AssociatedTypeRecordSize;
@@ -357,46 +321,12 @@ struct AssociatedTypeDescriptor {
357
321
}
358
322
};
359
323
360
- class AssociatedTypeIterator
361
- : public std::iterator<std::forward_iterator_tag, AssociatedTypeDescriptor> {
362
- public:
363
- const void *Cur;
364
- const void * const End;
365
- AssociatedTypeIterator (const void *Cur, const void * const End)
366
- : Cur(Cur), End(End) {}
367
-
368
- const AssociatedTypeDescriptor &operator *() const {
369
- return *reinterpret_cast <const AssociatedTypeDescriptor *>(Cur);
370
- }
371
-
372
- const AssociatedTypeDescriptor *operator ->() const {
373
- return reinterpret_cast <const AssociatedTypeDescriptor *>(Cur);
374
- }
375
-
376
- AssociatedTypeIterator &operator ++() {
377
- const auto &ATR = this ->operator *();
378
- size_t Size = sizeof (AssociatedTypeDescriptor) +
379
- ATR.NumAssociatedTypes * ATR.AssociatedTypeRecordSize ;
380
- const void *Next = reinterpret_cast <const char *>(Cur) + Size;
381
- Cur = Next;
382
- return *this ;
383
- }
384
-
385
- bool operator ==(AssociatedTypeIterator const &other) const {
386
- return Cur == other.Cur && End == other.End ;
387
- }
388
-
389
- bool operator !=(AssociatedTypeIterator const &other) const {
390
- return !(*this == other);
391
- }
392
- };
393
-
394
324
// Builtin type records describe basic layout information about
395
325
// any builtin types referenced from the other sections.
396
326
class BuiltinTypeDescriptor {
327
+ public:
397
328
const RelativeDirectPointer<const char > TypeName;
398
329
399
- public:
400
330
uint32_t Size;
401
331
402
332
// - Least significant 16 bits are the alignment.
@@ -424,42 +354,10 @@ class BuiltinTypeDescriptor {
424
354
}
425
355
};
426
356
427
- class BuiltinTypeDescriptorIterator
428
- : public std::iterator<std::forward_iterator_tag, BuiltinTypeDescriptor> {
429
- public:
430
- const void *Cur;
431
- const void * const End;
432
- BuiltinTypeDescriptorIterator (const void *Cur, const void * const End)
433
- : Cur(Cur), End(End) {}
434
-
435
- const BuiltinTypeDescriptor &operator *() const {
436
- return *reinterpret_cast <const BuiltinTypeDescriptor *>(Cur);
437
- }
438
-
439
- const BuiltinTypeDescriptor *operator ->() const {
440
- return reinterpret_cast <const BuiltinTypeDescriptor *>(Cur);;
441
- }
442
-
443
- BuiltinTypeDescriptorIterator &operator ++() {
444
- const void *Next = reinterpret_cast <const char *>(Cur)
445
- + sizeof (BuiltinTypeDescriptor);
446
- Cur = Next;
447
- return *this ;
448
- }
449
-
450
- bool operator ==(BuiltinTypeDescriptorIterator const &other) const {
451
- return Cur == other.Cur && End == other.End ;
452
- }
453
-
454
- bool operator !=(BuiltinTypeDescriptorIterator const &other) const {
455
- return !(*this == other);
456
- }
457
- };
458
-
459
357
class CaptureTypeRecord {
358
+ public:
460
359
const RelativeDirectPointer<const char > MangledTypeName;
461
360
462
- public:
463
361
CaptureTypeRecord () = delete ;
464
362
465
363
bool hasMangledTypeName () const {
@@ -502,10 +400,10 @@ struct CaptureTypeRecordIterator {
502
400
};
503
401
504
402
class MetadataSourceRecord {
403
+ public:
505
404
const RelativeDirectPointer<const char > MangledTypeName;
506
405
const RelativeDirectPointer<const char > MangledMetadataSource;
507
406
508
- public:
509
407
MetadataSourceRecord () = delete ;
510
408
511
409
bool hasMangledTypeName () const {
@@ -608,41 +506,6 @@ class CaptureDescriptor {
608
506
}
609
507
};
610
508
611
- class CaptureDescriptorIterator
612
- : public std::iterator<std::forward_iterator_tag, CaptureDescriptor> {
613
- public:
614
- const void *Cur;
615
- const void * const End;
616
- CaptureDescriptorIterator (const void *Cur, const void * const End)
617
- : Cur(Cur), End(End) {}
618
-
619
- const CaptureDescriptor &operator *() const {
620
- return *reinterpret_cast <const CaptureDescriptor *>(Cur);
621
- }
622
-
623
- const CaptureDescriptor *operator ->() const {
624
- return reinterpret_cast <const CaptureDescriptor *>(Cur);
625
- }
626
-
627
- CaptureDescriptorIterator &operator ++() {
628
- const auto &CR = this ->operator *();
629
- const void *Next = reinterpret_cast <const char *>(Cur)
630
- + sizeof (CaptureDescriptor)
631
- + CR.NumCaptureTypes * sizeof (CaptureTypeRecord)
632
- + CR.NumMetadataSources * sizeof (MetadataSourceRecord);
633
- Cur = Next;
634
- return *this ;
635
- }
636
-
637
- bool operator ==(CaptureDescriptorIterator const &other) const {
638
- return Cur == other.Cur && End == other.End ;
639
- }
640
-
641
- bool operator !=(CaptureDescriptorIterator const &other) const {
642
- return !(*this == other);
643
- }
644
- };
645
-
646
509
} // end namespace reflection
647
510
} // end namespace swift
648
511
0 commit comments