llvm.org GIT mirror llvm / 7ea2e48
Remove a use of InMemoryStruct in llvm-readobj. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178981 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 7 years ago
2 changed file(s) with 8 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
153153
154154 const MachOFormat::LinkeditDataLoadCommand *
155155 getLinkeditDataLoadCommand(LoadCommandInfo LCI) const;
156 const MachOFormat::Section64 *getSection64(DataRefImpl DRI) const;
157 const MachOFormat::Section *getSection(DataRefImpl DRI) const;
156158
157159 const MachOObject *getObject() const { return MachOObj.get(); }
158160
236238 const MachOFormat::SymtabLoadCommand *SymtabLoadCmd) const;
237239
238240 void moveToNextSymbol(DataRefImpl &DRI) const;
239 const MachOFormat::Section *getSection(DataRefImpl DRI) const;
240 const MachOFormat::Section64 *getSection64(DataRefImpl DRI) const;
241241 const MachOFormat::RelocationEntry *getRelocation(DataRefImpl Rel) const;
242242 const MachOFormat::SymtabLoadCommand *
243243 getSymtabLoadCommand(LoadCommandInfo LCI) const;
164164 return false;
165165 }
166166
167 static void getSection(const MachOObject *MachOObj,
167 static void getSection(const MachOObjectFile *Obj,
168168 DataRefImpl DRI,
169169 MachOSection &Section) {
170 LoadCommandInfo LCI = MachOObj->getLoadCommandInfo(DRI.d.a);
170 const MachOObject *MachOObj = Obj->getObject();
171
171172 if (is64BitLoadCommand(MachOObj, DRI)) {
172 InMemoryStruct Sect;
173 MachOObj->ReadSection64(LCI, DRI.d.b, Sect);
173 const MachOFormat::Section64 *Sect = Obj->getSection64(DRI);
174174
175175 Section.Address = Sect->Address;
176176 Section.Size = Sect->Size;
182182 Section.Reserved1 = Sect->Reserved1;
183183 Section.Reserved2 = Sect->Reserved2;
184184 } else {
185 InMemoryStruct Sect;
186 MachOObj->ReadSection(LCI, DRI.d.b, Sect);
185 const MachOFormat::Section *Sect = Obj->getSection(DRI);
187186
188187 Section.Address = Sect->Address;
189188 Section.Size = Sect->Size;
253252
254253 ++SectionIndex;
255254
256 const MachOObject *MachO = Obj->getObject();
257
258255 MachOSection Section;
259 getSection(MachO, SecI->getRawDataRefImpl(), Section);
256 getSection(Obj, SecI->getRawDataRefImpl(), Section);
260257 DataRefImpl DR = SecI->getRawDataRefImpl();
261258
262259 StringRef Name;