diff options
Diffstat (limited to 'include/llvm/Object/COFF.h')
-rw-r--r-- | include/llvm/Object/COFF.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/llvm/Object/COFF.h b/include/llvm/Object/COFF.h index 431029045f..f9d0c6e525 100644 --- a/include/llvm/Object/COFF.h +++ b/include/llvm/Object/COFF.h @@ -24,7 +24,9 @@ namespace llvm { namespace object { class ImportDirectoryEntryRef; +class ExportDirectoryEntryRef; typedef content_iterator<ImportDirectoryEntryRef> import_directory_iterator; +typedef content_iterator<ExportDirectoryEntryRef> export_directory_iterator; /// The DOS compatible header at the front of all PE/COFF executables. struct dos_header { @@ -245,6 +247,7 @@ struct coff_aux_section_definition { class COFFObjectFile : public ObjectFile { private: friend class ImportDirectoryEntryRef; + friend class ExportDirectoryEntryRef; const coff_file_header *COFFHeader; const pe32_header *PE32Header; const data_directory *DataDirectory; @@ -254,6 +257,7 @@ private: uint32_t StringTableSize; const import_directory_table_entry *ImportDirectory; uint32_t NumberOfImportDirectory; + const export_directory_table_entry *ExportDirectory; error_code getString(uint32_t offset, StringRef &Res) const; @@ -263,6 +267,7 @@ private: error_code initSymbolTablePtr(); error_code initImportTablePtr(); + error_code initExportTablePtr(); protected: virtual error_code getSymbolNext(DataRefImpl Symb, SymbolRef &Res) const; @@ -336,6 +341,8 @@ public: import_directory_iterator import_directory_begin() const; import_directory_iterator import_directory_end() const; + export_directory_iterator export_directory_begin() const; + export_directory_iterator export_directory_end() const; error_code getHeader(const coff_file_header *&Res) const; error_code getCOFFHeader(const coff_file_header *&Res) const; @@ -388,6 +395,26 @@ private: uint32_t Index; const COFFObjectFile *OwningObject; }; + +// The iterator for the export directory table entry. +class ExportDirectoryEntryRef { +public: + ExportDirectoryEntryRef() : OwningObject(0) {} + ExportDirectoryEntryRef(const export_directory_table_entry *Table, uint32_t I, + const COFFObjectFile *Owner) + : ExportTable(Table), Index(I), OwningObject(Owner) {} + + bool operator==(const ExportDirectoryEntryRef &Other) const; + error_code getNext(ExportDirectoryEntryRef &Result) const; + error_code getOrdinal(uint32_t &Result) const; + error_code getExportRVA(uint32_t &Result) const; + error_code getName(StringRef &Result) const; + +private: + const export_directory_table_entry *ExportTable; + uint32_t Index; + const COFFObjectFile *OwningObject; +}; } // end namespace object } // end namespace llvm |