forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
COFFImportDumper.cpp
52 lines (44 loc) · 1.63 KB
/
COFFImportDumper.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//===-- COFFImportDumper.cpp - COFF import library dumper -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief This file implements the COFF import library dumper for llvm-readobj.
///
//===----------------------------------------------------------------------===//
#include "Error.h"
#include "ObjDumper.h"
#include "llvm-readobj.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/COFFImportFile.h"
#include "llvm/Support/COFF.h"
using namespace llvm::object;
namespace llvm {
void dumpCOFFImportFile(const COFFImportFile *File) {
outs() << '\n';
outs() << "File: " << File->getFileName() << "\n";
outs() << "Format: COFF-import-file\n";
const coff_import_header *H = File->getCOFFImportHeader();
switch (H->getType()) {
case COFF::IMPORT_CODE: outs() << "Type: code\n"; break;
case COFF::IMPORT_DATA: outs() << "Type: data\n"; break;
case COFF::IMPORT_CONST: outs() << "Type: const\n"; break;
}
switch (H->getNameType()) {
case COFF::IMPORT_ORDINAL: outs() << "Name type: ordinal\n"; break;
case COFF::IMPORT_NAME: outs() << "Name type: name\n"; break;
case COFF::IMPORT_NAME_NOPREFIX: outs() << "Name type: noprefix\n"; break;
case COFF::IMPORT_NAME_UNDECORATE: outs() << "Name type: undecorate\n"; break;
}
for (const object::BasicSymbolRef &Sym : File->symbols()) {
outs() << "Symbol: ";
Sym.printName(outs());
outs() << "\n";
}
}
} // namespace llvm