mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[llvm-objdump][Wasm][NFC] Create WasmDump.h
Summary: Continuing from D77285, the external interfaces implemented by `WasmDump.cpp` are now declared in `WasmDump.h` and moved into the `llvm::objdump` namespace. Reviewers: jhenderson, MaskRay, DiggerLin, jasonliu, daltenty Reviewed By: jhenderson, MaskRay Differential Revision: https://reviews.llvm.org/D77990
This commit is contained in:
parent
476a701bb9
commit
41f2e52f97
@ -11,13 +11,15 @@
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "WasmDump.h"
|
||||
|
||||
#include "llvm-objdump.h"
|
||||
#include "llvm/Object/Wasm.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::object;
|
||||
|
||||
namespace llvm {
|
||||
void printWasmFileHeader(const object::ObjectFile *Obj) {
|
||||
void objdump::printWasmFileHeader(const object::ObjectFile *Obj) {
|
||||
const auto *File = dyn_cast<const WasmObjectFile>(Obj);
|
||||
|
||||
outs() << "Program Header:\n";
|
||||
@ -26,9 +28,9 @@ void printWasmFileHeader(const object::ObjectFile *Obj) {
|
||||
outs() << "\n";
|
||||
}
|
||||
|
||||
Error getWasmRelocationValueString(const WasmObjectFile *Obj,
|
||||
const RelocationRef &RelRef,
|
||||
SmallVectorImpl<char> &Result) {
|
||||
Error objdump::getWasmRelocationValueString(const WasmObjectFile *Obj,
|
||||
const RelocationRef &RelRef,
|
||||
SmallVectorImpl<char> &Result) {
|
||||
const wasm::WasmRelocation &Rel = Obj->getWasmRelocation(RelRef);
|
||||
symbol_iterator SI = RelRef.getSymbol();
|
||||
std::string FmtBuf;
|
||||
@ -49,4 +51,3 @@ Error getWasmRelocationValueString(const WasmObjectFile *Obj,
|
||||
Result.append(FmtBuf.begin(), FmtBuf.end());
|
||||
return Error::success();
|
||||
}
|
||||
} // namespace llvm
|
||||
|
35
tools/llvm-objdump/WasmDump.h
Normal file
35
tools/llvm-objdump/WasmDump.h
Normal file
@ -0,0 +1,35 @@
|
||||
//===-- WasmDump.h - wasm-specific dumper -----------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_TOOLS_LLVM_OBJDUMP_WASMDUMP_H
|
||||
#define LLVM_TOOLS_LLVM_OBJDUMP_WASMDUMP_H
|
||||
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class Error;
|
||||
|
||||
namespace object {
|
||||
class WasmObjectFile;
|
||||
class ObjectFile;
|
||||
class RelocationRef;
|
||||
} // namespace object
|
||||
|
||||
namespace objdump {
|
||||
|
||||
Error getWasmRelocationValueString(const object::WasmObjectFile *Obj,
|
||||
const object::RelocationRef &RelRef,
|
||||
llvm::SmallVectorImpl<char> &Result);
|
||||
|
||||
void printWasmFileHeader(const object::ObjectFile *O);
|
||||
|
||||
} // namespace objdump
|
||||
} // namespace llvm
|
||||
|
||||
#endif
|
@ -18,6 +18,7 @@
|
||||
#include "llvm-objdump.h"
|
||||
#include "COFFDump.h"
|
||||
#include "MachODump.h"
|
||||
#include "WasmDump.h"
|
||||
#include "XCOFFDump.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
|
@ -118,9 +118,6 @@ SectionFilter ToolSectionFilter(llvm::object::ObjectFile const &O,
|
||||
Error getELFRelocationValueString(const object::ELFObjectFileBase *Obj,
|
||||
const object::RelocationRef &Rel,
|
||||
llvm::SmallVectorImpl<char> &Result);
|
||||
Error getWasmRelocationValueString(const object::WasmObjectFile *Obj,
|
||||
const object::RelocationRef &RelRef,
|
||||
llvm::SmallVectorImpl<char> &Result);
|
||||
|
||||
uint64_t getELFSectionLMA(const object::ELFSectionRef& Sec);
|
||||
|
||||
@ -128,7 +125,6 @@ bool isRelocAddressLess(object::RelocationRef A, object::RelocationRef B);
|
||||
void printELFFileHeader(const object::ObjectFile *O);
|
||||
void printELFDynamicSection(const object::ObjectFile *Obj);
|
||||
void printELFSymbolVersionInfo(const object::ObjectFile *Obj);
|
||||
void printWasmFileHeader(const object::ObjectFile *O);
|
||||
void printRawClangAST(const object::ObjectFile *O);
|
||||
void printRelocations(const object::ObjectFile *O);
|
||||
void printDynamicRelocations(const object::ObjectFile *O);
|
||||
|
Loading…
Reference in New Issue
Block a user