mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 00:24:26 +00:00
Object: Add range iterators for COFF import/export table
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219383 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -75,9 +75,7 @@ private:
|
||||
SymbolRef &Sym);
|
||||
std::error_code resolveSymbolName(const coff_section *Section,
|
||||
uint64_t Offset, StringRef &Name);
|
||||
|
||||
void printImportedSymbols(imported_symbol_iterator I,
|
||||
imported_symbol_iterator E);
|
||||
void printImportedSymbols(iterator_range<imported_symbol_iterator> Range);
|
||||
|
||||
typedef DenseMap<const coff_section*, std::vector<RelocationRef> > RelocMapTy;
|
||||
|
||||
@ -886,50 +884,47 @@ void COFFDumper::printUnwindInfo() {
|
||||
}
|
||||
}
|
||||
|
||||
void COFFDumper::printImportedSymbols(imported_symbol_iterator I,
|
||||
imported_symbol_iterator E) {
|
||||
for (; I != E; ++I) {
|
||||
void COFFDumper::printImportedSymbols(
|
||||
iterator_range<imported_symbol_iterator> Range) {
|
||||
for (const ImportedSymbolRef &I : Range) {
|
||||
StringRef Sym;
|
||||
if (error(I->getSymbolName(Sym))) return;
|
||||
if (error(I.getSymbolName(Sym))) return;
|
||||
uint16_t Ordinal;
|
||||
if (error(I->getOrdinal(Ordinal))) return;
|
||||
if (error(I.getOrdinal(Ordinal))) return;
|
||||
W.printNumber("Symbol", Sym, Ordinal);
|
||||
}
|
||||
}
|
||||
|
||||
void COFFDumper::printCOFFImports() {
|
||||
// Regular imports
|
||||
for (auto I = Obj->import_directory_begin(), E = Obj->import_directory_end();
|
||||
I != E; ++I) {
|
||||
for (const ImportDirectoryEntryRef &I : Obj->import_directories()) {
|
||||
DictScope Import(W, "Import");
|
||||
StringRef Name;
|
||||
if (error(I->getName(Name))) return;
|
||||
if (error(I.getName(Name))) return;
|
||||
W.printString("Name", Name);
|
||||
uint32_t Addr;
|
||||
if (error(I->getImportLookupTableRVA(Addr))) return;
|
||||
if (error(I.getImportLookupTableRVA(Addr))) return;
|
||||
W.printHex("ImportLookupTableRVA", Addr);
|
||||
if (error(I->getImportAddressTableRVA(Addr))) return;
|
||||
if (error(I.getImportAddressTableRVA(Addr))) return;
|
||||
W.printHex("ImportAddressTableRVA", Addr);
|
||||
printImportedSymbols(I->imported_symbol_begin(), I->imported_symbol_end());
|
||||
printImportedSymbols(I.imported_symbols());
|
||||
}
|
||||
|
||||
// Delay imports
|
||||
for (auto I = Obj->delay_import_directory_begin(),
|
||||
E = Obj->delay_import_directory_end();
|
||||
I != E; ++I) {
|
||||
for (const DelayImportDirectoryEntryRef &I : Obj->delay_import_directories()) {
|
||||
DictScope Import(W, "DelayImport");
|
||||
StringRef Name;
|
||||
if (error(I->getName(Name))) return;
|
||||
if (error(I.getName(Name))) return;
|
||||
W.printString("Name", Name);
|
||||
const delay_import_directory_table_entry *Table;
|
||||
if (error(I->getDelayImportTable(Table))) return;
|
||||
if (error(I.getDelayImportTable(Table))) return;
|
||||
W.printHex("Attributes", Table->Attributes);
|
||||
W.printHex("ModuleHandle", Table->ModuleHandle);
|
||||
W.printHex("ImportAddressTable", Table->DelayImportAddressTable);
|
||||
W.printHex("ImportNameTable", Table->DelayImportNameTable);
|
||||
W.printHex("BoundDelayImportTable", Table->BoundDelayImportTable);
|
||||
W.printHex("UnloadDelayImportTable", Table->UnloadDelayImportTable);
|
||||
printImportedSymbols(I->imported_symbol_begin(), I->imported_symbol_end());
|
||||
printImportedSymbols(I.imported_symbols());
|
||||
}
|
||||
}
|
||||
|
||||
@ -949,4 +944,3 @@ void COFFDumper::printCOFFDirectives() {
|
||||
W.printString("Directive(s)", Contents);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user