@@ -202,7 +202,7 @@ class ReflectionContext
202
202
RangeEnd - RangeStart);
203
203
204
204
auto findMachOSectionByName = [&](std::string Name)
205
- -> std::pair<std::pair< const char *, const char *>, uint64_t > {
205
+ -> std::pair<const char *, const char *> {
206
206
for (unsigned I = 0 ; I < NumSect; ++I) {
207
207
auto S = reinterpret_cast <typename T::Section *>(
208
208
SectionsBuf + (I * sizeof (typename T::Section)));
@@ -213,9 +213,9 @@ class ReflectionContext
213
213
auto LocalSectStart =
214
214
reinterpret_cast <const char *>(SectBufData + RemoteSecStart - RangeStart);
215
215
auto LocalSectEnd = reinterpret_cast <const char *>(LocalSectStart + S->size );
216
- return {{ LocalSectStart, LocalSectEnd}, 0 };
216
+ return {LocalSectStart, LocalSectEnd};
217
217
}
218
- return {{ nullptr , nullptr }, 0 };
218
+ return {nullptr , nullptr };
219
219
};
220
220
221
221
auto FieldMdSec = findMachOSectionByName (" __swift5_fieldmd" );
@@ -225,24 +225,24 @@ class ReflectionContext
225
225
auto TypeRefMdSec = findMachOSectionByName (" __swift5_typeref" );
226
226
auto ReflStrMdSec = findMachOSectionByName (" __swift5_reflstr" );
227
227
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 )
234
234
return false ;
235
235
236
236
auto LocalStartAddress = reinterpret_cast <uint64_t >(SectBuf.get ());
237
237
auto RemoteStartAddress = static_cast <uint64_t >(RangeStart);
238
238
239
239
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 },
246
246
LocalStartAddress,
247
247
RemoteStartAddress};
248
248
@@ -310,7 +310,7 @@ class ReflectionContext
310
310
sizeof (llvm::object::coff_section) * COFFFileHdr->NumberOfSections );
311
311
312
312
auto findCOFFSectionByName = [&](llvm::StringRef Name)
313
- -> std::pair<std::pair< const char *, const char *>, uint32_t > {
313
+ -> std::pair<const char *, const char *> {
314
314
for (size_t i = 0 ; i < COFFFileHdr->NumberOfSections ; ++i) {
315
315
const llvm::object::coff_section *COFFSec =
316
316
reinterpret_cast <const llvm::object::coff_section *>(
@@ -336,45 +336,43 @@ class ReflectionContext
336
336
End -= 8 ;
337
337
}
338
338
339
- return {{ Begin, End}, 0 };
339
+ return {Begin, End};
340
340
}
341
- return {{ nullptr , nullptr }, 0 };
341
+ return {nullptr , nullptr };
342
342
};
343
343
344
- std::pair<std::pair< const char *, const char *>, uint32_t > CaptureSec =
344
+ std::pair<const char *, const char *> CaptureSec =
345
345
findCOFFSectionByName (" .sw5cptr" );
346
- std::pair<std::pair< const char *, const char *>, uint32_t > TypeRefMdSec =
346
+ std::pair<const char *, const char *> TypeRefMdSec =
347
347
findCOFFSectionByName (" .sw5tyrf" );
348
- std::pair<std::pair< const char *, const char *>, uint32_t > FieldMdSec =
348
+ std::pair<const char *, const char *> FieldMdSec =
349
349
findCOFFSectionByName (" .sw5flmd" );
350
- std::pair<std::pair< const char *, const char *>, uint32_t > AssocTySec =
350
+ std::pair<const char *, const char *> AssocTySec =
351
351
findCOFFSectionByName (" .sw5asty" );
352
- std::pair<std::pair< const char *, const char *>, uint32_t > BuiltinTySec =
352
+ std::pair<const char *, const char *> BuiltinTySec =
353
353
findCOFFSectionByName (" .sw5bltn" );
354
- std::pair<std::pair< const char *, const char *>, uint32_t > ReflStrMdSec =
354
+ std::pair<const char *, const char *> ReflStrMdSec =
355
355
findCOFFSectionByName (" .sw5rfst" );
356
356
357
- if (FieldMdSec.first . first == nullptr &&
358
- AssocTySec.first . first == nullptr &&
359
- BuiltinTySec.first . first == nullptr &&
360
- CaptureSec.first . first == nullptr &&
361
- TypeRefMdSec.first . first == nullptr &&
362
- ReflStrMdSec.first . first == nullptr )
357
+ if (FieldMdSec.first == nullptr &&
358
+ AssocTySec.first == nullptr &&
359
+ BuiltinTySec.first == nullptr &&
360
+ CaptureSec.first == nullptr &&
361
+ TypeRefMdSec.first == nullptr &&
362
+ ReflStrMdSec.first == nullptr )
363
363
return false ;
364
+
364
365
auto LocalStartAddress = reinterpret_cast <uintptr_t >(DOSHdrBuf.get ());
365
366
auto RemoteStartAddress =
366
367
static_cast <uintptr_t >(ImageStart.getAddressData ());
367
368
368
369
ReflectionInfo Info = {
369
- {{FieldMdSec.first .first , FieldMdSec.first .second }, FieldMdSec.second },
370
- {{AssocTySec.first .first , AssocTySec.first .second }, AssocTySec.second },
371
- {{BuiltinTySec.first .first , BuiltinTySec.first .second },
372
- BuiltinTySec.second },
373
- {{CaptureSec.first .first , CaptureSec.first .second }, CaptureSec.second },
374
- {{TypeRefMdSec.first .first , TypeRefMdSec.first .second },
375
- TypeRefMdSec.second },
376
- {{ReflStrMdSec.first .first , ReflStrMdSec.first .second },
377
- ReflStrMdSec.second },
370
+ {{FieldMdSec.first , FieldMdSec.second }, 0 },
371
+ {{AssocTySec.first , AssocTySec.second }, 0 },
372
+ {{BuiltinTySec.first , BuiltinTySec.second }, 0 },
373
+ {{CaptureSec.first , CaptureSec.second }, 0 },
374
+ {{TypeRefMdSec.first , TypeRefMdSec.second }, 0 },
375
+ {{ReflStrMdSec.first , ReflStrMdSec.second }, 0 },
378
376
LocalStartAddress,
379
377
RemoteStartAddress};
380
378
this ->addReflectionInfo (Info);
@@ -450,7 +448,7 @@ class ReflectionContext
450
448
auto StrTab = reinterpret_cast <const char *>(StrTabBuf.get ());
451
449
452
450
auto findELFSectionByName = [&](std::string Name)
453
- -> std::pair<std::pair< const char *, const char *>, uint64_t > {
451
+ -> std::pair<const char *, const char *> {
454
452
// Now for all the sections, find their name.
455
453
for (const typename T::Section *Hdr : SecHdrVec) {
456
454
uint32_t Offset = Hdr->sh_name ;
@@ -462,9 +460,9 @@ class ReflectionContext
462
460
auto SecSize = Hdr->sh_size ;
463
461
auto SecBuf = this ->getReader ().readBytes (SecStart, SecSize);
464
462
auto SecContents = reinterpret_cast <const char *>(SecBuf.get ());
465
- return {{ SecContents, SecContents + SecSize}, 0 };
463
+ return {SecContents, SecContents + SecSize};
466
464
}
467
- return {{ nullptr , nullptr }, 0 };
465
+ return {nullptr , nullptr };
468
466
};
469
467
470
468
auto FieldMdSec = findELFSectionByName (" swift5_fieldmd" );
@@ -476,28 +474,25 @@ class ReflectionContext
476
474
477
475
// We succeed if at least one of the sections is present in the
478
476
// ELF executable.
479
- if (FieldMdSec.first . first == nullptr &&
480
- AssocTySec.first . first == nullptr &&
481
- BuiltinTySec.first . first == nullptr &&
482
- CaptureSec.first . first == nullptr &&
483
- TypeRefMdSec.first . first == nullptr &&
484
- ReflStrMdSec.first . first == nullptr )
477
+ if (FieldMdSec.first == nullptr &&
478
+ AssocTySec.first == nullptr &&
479
+ BuiltinTySec.first == nullptr &&
480
+ CaptureSec.first == nullptr &&
481
+ TypeRefMdSec.first == nullptr &&
482
+ ReflStrMdSec.first == nullptr )
485
483
return false ;
486
484
487
485
auto LocalStartAddress = reinterpret_cast <uint64_t >(Buf.get ());
488
486
auto RemoteStartAddress =
489
487
static_cast <uint64_t >(ImageStart.getAddressData ());
490
488
491
489
ReflectionInfo info = {
492
- {{FieldMdSec.first .first , FieldMdSec.first .second }, FieldMdSec.second },
493
- {{AssocTySec.first .first , AssocTySec.first .second }, AssocTySec.second },
494
- {{BuiltinTySec.first .first , BuiltinTySec.first .second },
495
- BuiltinTySec.second },
496
- {{CaptureSec.first .first , CaptureSec.first .second }, CaptureSec.second },
497
- {{TypeRefMdSec.first .first , TypeRefMdSec.first .second },
498
- TypeRefMdSec.second },
499
- {{ReflStrMdSec.first .first , ReflStrMdSec.first .second },
500
- ReflStrMdSec.second },
490
+ {{FieldMdSec.first , FieldMdSec.second }, 0 },
491
+ {{AssocTySec.first , AssocTySec.second }, 0 },
492
+ {{BuiltinTySec.first , BuiltinTySec.second }, 0 },
493
+ {{CaptureSec.first , CaptureSec.second }, 0 },
494
+ {{TypeRefMdSec.first , TypeRefMdSec.second }, 0 },
495
+ {{ReflStrMdSec.first , ReflStrMdSec.second }, 0 },
501
496
LocalStartAddress,
502
497
RemoteStartAddress};
503
498
0 commit comments