Remove the default clause from a fully-covering switch
[llvm-core.git] / tools / llvm-readobj / COFFImportDumper.cpp
blobc5b8bf75846275bd142a33322f29c54f877511c6
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 //===----------------------------------------------------------------------===//
15 #include "Error.h"
16 #include "ObjDumper.h"
17 #include "llvm-readobj.h"
18 #include "llvm/BinaryFormat/COFF.h"
19 #include "llvm/Object/COFF.h"
20 #include "llvm/Object/COFFImportFile.h"
22 using namespace llvm::object;
24 namespace llvm {
26 void dumpCOFFImportFile(const COFFImportFile *File) {
27 outs() << '\n';
28 outs() << "File: " << File->getFileName() << "\n";
29 outs() << "Format: COFF-import-file\n";
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;
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;
45 for (const object::BasicSymbolRef &Sym : File->symbols()) {
46 outs() << "Symbol: ";
47 Sym.printName(outs());
48 outs() << "\n";
52 } // namespace llvm