]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/llvm-objcopy/COFF/Reader.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / llvm-objcopy / COFF / Reader.h
1 //===- Reader.h -------------------------------------------------*- 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 #ifndef LLVM_TOOLS_OBJCOPY_COFF_READER_H
11 #define LLVM_TOOLS_OBJCOPY_COFF_READER_H
12
13 #include "Buffer.h"
14 #include "llvm/BinaryFormat/COFF.h"
15 #include "llvm/Object/COFF.h"
16 #include "llvm/Support/Error.h"
17
18 namespace llvm {
19 namespace objcopy {
20 namespace coff {
21
22 struct Object;
23
24 using object::COFFObjectFile;
25
26 class COFFReader {
27   const COFFObjectFile &COFFObj;
28
29   Error readExecutableHeaders(Object &Obj) const;
30   Error readSections(Object &Obj) const;
31   Error readSymbols(Object &Obj, bool IsBigObj) const;
32   Error setRelocTargets(Object &Obj) const;
33
34 public:
35   explicit COFFReader(const COFFObjectFile &O) : COFFObj(O) {}
36   Expected<std::unique_ptr<Object>> create() const;
37 };
38
39 } // end namespace coff
40 } // end namespace objcopy
41 } // end namespace llvm
42
43 #endif // LLVM_TOOLS_OBJCOPY_COFF_READER_H