Skip to content

Commit f13031f

Browse files
committed
Reflection: remove unnecessary offset for MachO
Don't bother passing the slide for the MachO image as it is always 0.
1 parent f298603 commit f13031f

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

include/swift/Reflection/ReflectionContext.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class ReflectionContext
202202
RangeEnd - RangeStart);
203203

204204
auto findMachOSectionByName = [&](std::string Name)
205-
-> std::pair<std::pair<const char *, const char *>, uint64_t> {
205+
-> std::pair<const char *, const char *> {
206206
for (unsigned I = 0; I < NumSect; ++I) {
207207
auto S = reinterpret_cast<typename T::Section *>(
208208
SectionsBuf + (I * sizeof(typename T::Section)));
@@ -213,9 +213,9 @@ class ReflectionContext
213213
auto LocalSectStart =
214214
reinterpret_cast<const char *>(SectBufData + RemoteSecStart - RangeStart);
215215
auto LocalSectEnd = reinterpret_cast<const char *>(LocalSectStart + S->size);
216-
return {{LocalSectStart, LocalSectEnd}, 0};
216+
return {LocalSectStart, LocalSectEnd};
217217
}
218-
return {{nullptr, nullptr}, 0};
218+
return {nullptr, nullptr};
219219
};
220220

221221
auto FieldMdSec = findMachOSectionByName("__swift5_fieldmd");
@@ -225,24 +225,24 @@ class ReflectionContext
225225
auto TypeRefMdSec = findMachOSectionByName("__swift5_typeref");
226226
auto ReflStrMdSec = findMachOSectionByName("__swift5_reflstr");
227227

228-
if (FieldMdSec.first.first == nullptr &&
229-
AssocTySec.first.first == nullptr &&
230-
BuiltinTySec.first.first == nullptr &&
231-
CaptureSec.first.first == nullptr &&
232-
TypeRefMdSec.first.first == nullptr &&
233-
ReflStrMdSec.first.first == nullptr)
228+
if (FieldMdSec.first == nullptr &&
229+
AssocTySec.first == nullptr &&
230+
BuiltinTySec.first == nullptr &&
231+
CaptureSec.first == nullptr &&
232+
TypeRefMdSec.first == nullptr &&
233+
ReflStrMdSec.first == nullptr)
234234
return false;
235235

236236
auto LocalStartAddress = reinterpret_cast<uint64_t>(SectBuf.get());
237237
auto RemoteStartAddress = static_cast<uint64_t>(RangeStart);
238238

239239
ReflectionInfo info = {
240-
{{FieldMdSec.first.first, FieldMdSec.first.second}, 0},
241-
{{AssocTySec.first.first, AssocTySec.first.second}, 0},
242-
{{BuiltinTySec.first.first, BuiltinTySec.first.second}, 0},
243-
{{CaptureSec.first.first, CaptureSec.first.second}, 0},
244-
{{TypeRefMdSec.first.first, TypeRefMdSec.first.second}, 0},
245-
{{ReflStrMdSec.first.first, ReflStrMdSec.first.second}, 0},
240+
{{FieldMdSec.first, FieldMdSec.second}, 0},
241+
{{AssocTySec.first, AssocTySec.second}, 0},
242+
{{BuiltinTySec.first, BuiltinTySec.second}, 0},
243+
{{CaptureSec.first, CaptureSec.second}, 0},
244+
{{TypeRefMdSec.first, TypeRefMdSec.second}, 0},
245+
{{ReflStrMdSec.first, ReflStrMdSec.second}, 0},
246246
LocalStartAddress,
247247
RemoteStartAddress};
248248

0 commit comments

Comments
 (0)