llvm.org GIT mirror llvm / 4b81ee4
Fix style issues. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199423 91177308-0d34-0410-b5e6-96231b3b80d8 Rui Ueyama 6 years ago
1 changed file(s) with 30 addition(s) and 24 deletion(s). Raw diff Collapse all Expand all
160160 const SymbolRef &Sym,
161161 const coff_section *&ResolvedSection,
162162 uint64_t &ResolvedAddr) {
163 if (error_code ec = Sym.getAddress(ResolvedAddr)) return ec;
163 if (error_code EC = Sym.getAddress(ResolvedAddr))
164 return EC;
164165 section_iterator iter(Obj->begin_sections());
165 if (error_code ec = Sym.getSection(iter)) return ec;
166 if (error_code EC = Sym.getSection(iter))
167 return EC;
166168 ResolvedSection = Obj->getCOFFSection(iter);
167169 return object_error::success;
168170 }
175177 E = Rels.end();
176178 I != E; ++I) {
177179 uint64_t Ofs;
178 if (error_code ec = I->getOffset(Ofs)) return ec;
180 if (error_code EC = I->getOffset(Ofs))
181 return EC;
179182 if (Ofs == Offset) {
180183 Sym = *I->getSymbol();
181184 break;
196199 SymbolRef Sym;
197200 if (error_code ec = resolveSymbol(Rels, Offset, Sym)) return ec;
198201 const coff_section *Section;
199 if (error_code ec = resolveSectionAndAddress(Obj, Sym, Section, Addr))
200 return ec;
201 if (error_code ec = Obj->getSectionContents(Section, Contents)) return ec;
202 if (error_code EC = resolveSectionAndAddress(Obj, Sym, Section, Addr))
203 return EC;
204 if (error_code EC = Obj->getSectionContents(Section, Contents))
205 return EC;
202206 return object_error::success;
203207 }
204208
208212 static error_code resolveSymbolName(const std::vector &Rels,
209213 uint64_t Offset, StringRef &Name) {
210214 SymbolRef Sym;
211 if (error_code ec = resolveSymbol(Rels, Offset, Sym)) return ec;
212 if (error_code ec = Sym.getName(Name)) return ec;
215 if (error_code EC = resolveSymbol(Rels, Offset, Sym))
216 return EC;
217 if (error_code EC = Sym.getName(Name))
218 return EC;
213219 return object_error::success;
214220 }
215221
217223 const std::vector &Rels,
218224 uint64_t Offset, uint32_t Disp) {
219225 StringRef Sym;
220 if (error_code ec = resolveSymbolName(Rels, Offset, Sym)) {
221 error(ec);
226 if (error_code EC = resolveSymbolName(Rels, Offset, Sym)) {
227 error(EC);
222228 return ;
223229 }
224230 Out << Sym;
229235 // Prints import tables. The import table is a table containing the list of
230236 // DLL name and symbol names which will be linked by the loader.
231237 static void printImportTables(const COFFObjectFile *Obj) {
232 import_directory_iterator i = Obj->import_directory_begin();
233 import_directory_iterator e = Obj->import_directory_end();
234 if (i == e)
238 import_directory_iterator I = Obj->import_directory_begin();
239 import_directory_iterator E = Obj->import_directory_end();
240 if (I == E)
235241 return;
236242 outs() << "The Import Tables:\n";
237 error_code ec;
238 for (; i != e; i = i.increment(ec)) {
239 if (ec)
243 error_code EC;
244 for (; I != E; I = I.increment(EC)) {
245 if (EC)
240246 return;
241247
242248 const import_directory_table_entry *Dir;
243249 StringRef Name;
244 if (i->getImportTableEntry(Dir)) return;
245 if (i->getName(Name)) return;
250 if (I->getImportTableEntry(Dir)) return;
251 if (I->getName(Name)) return;
246252
247253 outs() << format(" lookup %08x time %08x fwd %08x name %08x addr %08x\n\n",
248254 static_cast(Dir->ImportLookupTableRVA),
253259 outs() << " DLL Name: " << Name << "\n";
254260 outs() << " Hint/Ord Name\n";
255261 const import_lookup_table_entry32 *entry;
256 if (i->getImportLookupEntry(entry))
262 if (I->getImportLookupEntry(entry))
257263 return;
258264 for (; entry->data; ++entry) {
259265 if (entry->isOrdinal()) {
316322
317323 const coff_section *Pdata = 0;
318324
319 error_code ec;
325 error_code EC;
320326 for (section_iterator SI = Obj->begin_sections(),
321327 SE = Obj->end_sections();
322 SI != SE; SI.increment(ec)) {
323 if (error(ec)) return;
328 SI != SE; SI.increment(EC)) {
329 if (error(EC)) return;
324330
325331 StringRef Name;
326332 if (error(SI->getName(Name))) continue;
331337 std::vector Rels;
332338 for (relocation_iterator RI = SI->begin_relocations(),
333339 RE = SI->end_relocations();
334 RI != RE; RI.increment(ec)) {
335 if (error(ec)) break;
340 RI != RE; RI.increment(EC)) {
341 if (error(EC)) break;
336342 Rels.push_back(*RI);
337343 }
338344