[Orc] Enable user-supplied memory managers in the CompileOnDemand layer.
[oota-llvm.git] / tools / llvm-readobj / COFFImportDumper.cpp
1 //===-- COFFImportDumper.cpp - COFF import library dumper -------*- 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 /// \file
11 /// \brief This file implements the COFF import library dumper for llvm-readobj.
12 ///
13 //===----------------------------------------------------------------------===//
14
15 #include "Error.h"
16 #include "ObjDumper.h"
17 #include "llvm-readobj.h"
18 #include "llvm/Object/COFF.h"
19 #include "llvm/Object/COFFImportFile.h"
20 #include "llvm/Support/COFF.h"
21
22 using namespace llvm::object;
23
24 namespace llvm {
25
26 void dumpCOFFImportFile(const COFFImportFile *File) {
27   outs() << '\n';
28   outs() << "File: " << File->getFileName() << "\n";
29   outs() << "Format: COFF-import-file\n";
30
31   const coff_import_header *H = File->getCOFFImportHeader();
32   switch (H->getType()) {
33   case COFF::IMPORT_CODE:  outs() << "Type: code\n"; break;
34   case COFF::IMPORT_DATA:  outs() << "Type: data\n"; break;
35   case COFF::IMPORT_CONST: outs() << "Type: const\n"; break;
36   }
37
38   switch (H->getNameType()) {
39   case COFF::IMPORT_ORDINAL: outs() << "Name type: ordinal\n"; break;
40   case COFF::IMPORT_NAME: outs() << "Name type: name\n"; break;
41   case COFF::IMPORT_NAME_NOPREFIX: outs() << "Name type: noprefix\n"; break;
42   case COFF::IMPORT_NAME_UNDECORATE: outs() << "Name type: undecorate\n"; break;
43   }
44
45   for (const object::BasicSymbolRef &Sym : File->symbols()) {
46     outs() << "Symbol: ";
47     Sym.printName(outs());
48     outs() << "\n";
49   }
50 }
51
52 } // namespace llvm