LLVM  4.0.0
COFFImportFile.h
Go to the documentation of this file.
1 //===- COFFImportFile.h - COFF short import file implementation -*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // COFF short import file is a special kind of file which contains
11 // only symbol names for DLL-exported symbols. This class implements
12 // SymbolicFile interface for the file.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_OBJECT_COFF_IMPORT_FILE_H
17 #define LLVM_OBJECT_COFF_IMPORT_FILE_H
18 
19 #include "llvm/Object/COFF.h"
21 #include "llvm/Object/ObjectFile.h"
25 
26 namespace llvm {
27 namespace object {
28 
29 class COFFImportFile : public SymbolicFile {
30 public:
32  : SymbolicFile(ID_COFFImportFile, Source) {}
33 
34  static inline bool classof(Binary const *V) { return V->isCOFFImportFile(); }
35 
36  void moveSymbolNext(DataRefImpl &Symb) const override { ++Symb.p; }
37 
38  std::error_code printSymbolName(raw_ostream &OS,
39  DataRefImpl Symb) const override {
40  if (Symb.p == 0)
41  OS << "__imp_";
43  return std::error_code();
44  }
45 
46  uint32_t getSymbolFlags(DataRefImpl Symb) const override {
47  return SymbolRef::SF_Global;
48  }
49 
51  return BasicSymbolRef(DataRefImpl(), this);
52  }
53 
54  basic_symbol_iterator symbol_end() const override {
55  DataRefImpl Symb;
56  Symb.p = isCode() ? 2 : 1;
57  return BasicSymbolRef(Symb, this);
58  }
59 
61  return reinterpret_cast<const object::coff_import_header *>(
63  }
64 
65 private:
66  bool isCode() const {
68  }
69 };
70 
71 } // namespace object
72 } // namespace llvm
73 
74 #endif
const char * getBufferStart() const
Definition: MemoryBuffer.h:173
void moveSymbolNext(DataRefImpl &Symb) const override
uint32_t getSymbolFlags(DataRefImpl Symb) const override
std::error_code printSymbolName(raw_ostream &OS, DataRefImpl Symb) const override
bool isCOFFImportFile() const
Definition: Binary.h:122
COFFImportFile(MemoryBufferRef Source)
const coff_import_header * getCOFFImportHeader() const
MemoryBufferRef Data
Definition: Binary.h:37
This is a value type class that represents a single symbol in the list of symbols in the object file...
Definition: SymbolicFile.h:86
static bool classof(Binary const *V)
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
basic_symbol_iterator symbol_begin() const override
basic_symbol_iterator symbol_end() const override