[PATCH] D54413: [ELF] Pass LLDDwarfObj to readPubNamesAndTypes
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 11 21:56:12 PST 2018
MaskRay created this revision.
MaskRay added a reviewer: ruiu.
Herald added subscribers: llvm-commits, JDevlieghere, arichardson, emaste.
Herald added a reviewer: espindola.
We reorder the processing of .debug_gnu_pub{names,types} and other .gdb_index components, so as to save a static_cast.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D54413
Files:
ELF/SyntheticSections.cpp
Index: ELF/SyntheticSections.cpp
===================================================================
--- ELF/SyntheticSections.cpp
+++ ELF/SyntheticSections.cpp
@@ -2414,8 +2414,7 @@
template <class ELFT>
static std::vector<GdbIndexSection::NameTypeEntry>
-readPubNamesAndTypes(DWARFContext &Dwarf, uint32_t Idx) {
- auto &Obj = static_cast<const LLDDwarfObj<ELFT> &>(Dwarf.getDWARFObj());
+readPubNamesAndTypes(LLDDwarfObj<ELFT> &Obj, uint32_t Idx) {
const DWARFSection &PubNames = Obj.getGnuPubNamesSection();
const DWARFSection &PubTypes = Obj.getGnuPubTypesSection();
@@ -2514,12 +2513,13 @@
parallelForEachN(0, Sections.size(), [&](size_t I) {
ObjFile<ELFT> *File = Sections[I]->getFile<ELFT>();
- DWARFContext Dwarf(make_unique<LLDDwarfObj<ELFT>>(File));
+ auto Obj = make_unique<LLDDwarfObj<ELFT>>(File);
+ NameTypes[I] = readPubNamesAndTypes<ELFT>(*Obj, I);
+ DWARFContext Dwarf(std::move(Obj));
Chunks[I].Sec = Sections[I];
Chunks[I].CompilationUnits = readCuList(Dwarf);
Chunks[I].AddressAreas = readAddressAreas(Dwarf, Sections[I]);
- NameTypes[I] = readPubNamesAndTypes<ELFT>(Dwarf, I);
});
auto *Ret = make<GdbIndexSection>();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54413.173614.patch
Type: text/x-patch
Size: 1203 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181112/e32b8c39/attachment.bin>
More information about the llvm-commits
mailing list