Skip to content

Commit 9627aa9

Browse files
committed
Reflection: Add operator-> overloads to reflection section iterators
1 parent 8f3279a commit 9627aa9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

include/swift/Reflection/Records.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ struct FieldRecordIterator {
8585
return *Cur;
8686
}
8787

88+
const FieldRecord *operator->() const {
89+
return Cur;
90+
}
91+
8892
FieldRecordIterator &operator++() {
8993
++Cur;
9094
return *this;
@@ -159,6 +163,10 @@ class FieldDescriptorIterator
159163
return *reinterpret_cast<const FieldDescriptor *>(Cur);
160164
}
161165

166+
const FieldDescriptor *operator->() const {
167+
return reinterpret_cast<const FieldDescriptor *>(Cur);
168+
}
169+
162170
FieldDescriptorIterator &operator++() {
163171
const auto &FR = this->operator*();
164172
const void *Next = reinterpret_cast<const char *>(Cur)
@@ -207,6 +215,10 @@ struct AssociatedTypeRecordIterator {
207215
return *Cur;
208216
}
209217

218+
const AssociatedTypeRecord *operator->() const {
219+
return Cur;
220+
}
221+
210222
AssociatedTypeRecordIterator &operator++() {
211223
++Cur;
212224
return *this;
@@ -278,6 +290,10 @@ class AssociatedTypeIterator
278290
return *reinterpret_cast<const AssociatedTypeDescriptor *>(Cur);
279291
}
280292

293+
const AssociatedTypeDescriptor *operator->() const {
294+
return reinterpret_cast<const AssociatedTypeDescriptor *>(Cur);
295+
}
296+
281297
AssociatedTypeIterator &operator++() {
282298
const auto &ATR = this->operator*();
283299
size_t Size = sizeof(AssociatedTypeDescriptor) +
@@ -328,6 +344,10 @@ class BuiltinTypeDescriptorIterator
328344
return *reinterpret_cast<const BuiltinTypeDescriptor *>(Cur);
329345
}
330346

347+
const BuiltinTypeDescriptor *operator->() const {
348+
return reinterpret_cast<const BuiltinTypeDescriptor *>(Cur);;
349+
}
350+
331351
BuiltinTypeDescriptorIterator &operator++() {
332352
const void *Next = reinterpret_cast<const char *>(Cur)
333353
+ sizeof(BuiltinTypeDescriptor);

0 commit comments

Comments
 (0)