-//===-- StreamWriter.h ----------------------------------------------------===//
+//===-- ScopedPrinter.h ---------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_TOOLS_LLVM_READOBJ_STREAMWRITER_H
-#define LLVM_TOOLS_LLVM_READOBJ_STREAMWRITER_H
+#ifndef LLVM_SUPPORT_SCOPEDPRINTER_H
+#define LLVM_SUPPORT_SCOPEDPRINTER_H
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/ArrayRef.h"
namespace llvm {
-template<typename T>
-struct EnumEntry {
+template <typename T> struct EnumEntry {
StringRef Name;
// While Name suffices in most of the cases, in certain cases
// GNU style and LLVM style of ELFDumper do not
// unsigned type. The overloads are here so that every type that is implicitly
// convertible to an integer (including enums and endian helpers) can be used
// without requiring type traits or call-site changes.
- HexNumber(char Value) : Value(static_cast<unsigned char>(Value)) { }
- HexNumber(signed char Value) : Value(static_cast<unsigned char>(Value)) { }
- HexNumber(signed short Value) : Value(static_cast<unsigned short>(Value)) { }
- HexNumber(signed int Value) : Value(static_cast<unsigned int>(Value)) { }
- HexNumber(signed long Value) : Value(static_cast<unsigned long>(Value)) { }
- HexNumber(signed long long Value) : Value(static_cast<unsigned long long>(Value)) { }
- HexNumber(unsigned char Value) : Value(Value) { }
- HexNumber(unsigned short Value) : Value(Value) { }
- HexNumber(unsigned int Value) : Value(Value) { }
- HexNumber(unsigned long Value) : Value(Value) { }
- HexNumber(unsigned long long Value) : Value(Value) { }
+ HexNumber(char Value) : Value(static_cast<unsigned char>(Value)) {}
+ HexNumber(signed char Value) : Value(static_cast<unsigned char>(Value)) {}
+ HexNumber(signed short Value) : Value(static_cast<unsigned short>(Value)) {}
+ HexNumber(signed int Value) : Value(static_cast<unsigned int>(Value)) {}
+ HexNumber(signed long Value) : Value(static_cast<unsigned long>(Value)) {}
+ HexNumber(signed long long Value)
+ : Value(static_cast<unsigned long long>(Value)) {}
+ HexNumber(unsigned char Value) : Value(Value) {}
+ HexNumber(unsigned short Value) : Value(Value) {}
+ HexNumber(unsigned int Value) : Value(Value) {}
+ HexNumber(unsigned long Value) : Value(Value) {}
+ HexNumber(unsigned long long Value) : Value(Value) {}
uint64_t Value;
};
-raw_ostream &operator<<(raw_ostream &OS, const HexNumber& Value);
+raw_ostream &operator<<(raw_ostream &OS, const HexNumber &Value);
const std::string to_hexString(uint64_t Value, bool UpperCase = true);
template <class T> const std::string to_string(const T &Value) {
return stream.str();
}
-class StreamWriter {
+class ScopedPrinter {
public:
- StreamWriter(raw_ostream &OS)
- : OS(OS)
- , IndentLevel(0) {
- }
+ ScopedPrinter(raw_ostream &OS) : OS(OS), IndentLevel(0) {}
- void flush() {
- OS.flush();
- }
+ void flush() { OS.flush(); }
- void indent(int Levels = 1) {
- IndentLevel += Levels;
- }
+ void indent(int Levels = 1) { IndentLevel += Levels; }
void unindent(int Levels = 1) {
IndentLevel = std::max(0, IndentLevel - Levels);
OS << " ";
}
- template<typename T>
- HexNumber hex(T Value) {
- return HexNumber(Value);
- }
+ template <typename T> HexNumber hex(T Value) { return HexNumber(Value); }
- template<typename T, typename TEnum>
+ template <typename T, typename TEnum>
void printEnum(StringRef Label, T Value,
- ArrayRef<EnumEntry<TEnum> > EnumValues) {
+ ArrayRef<EnumEntry<TEnum>> EnumValues) {
StringRef Name;
bool Found = false;
for (const auto &EnumItem : EnumValues) {
EnumMask = EnumMask3;
bool IsEnum = (Flag.Value & EnumMask) != 0;
if ((!IsEnum && (Value & Flag.Value) == Flag.Value) ||
- (IsEnum && (Value & EnumMask) == Flag.Value)) {
+ (IsEnum && (Value & EnumMask) == Flag.Value)) {
SetFlags.push_back(Flag);
}
}
startLine() << "]\n";
}
- template<typename T>
- void printFlags(StringRef Label, T Value) {
+ template <typename T> void printFlags(StringRef Label, T Value) {
startLine() << Label << " [ (" << hex(Value) << ")\n";
uint64_t Flag = 1;
uint64_t Curr = Value;
startLine() << Label << ": " << (Value ? "Yes" : "No") << '\n';
}
- template <typename T>
- void printList(StringRef Label, const T &List) {
+ template <typename T> void printList(StringRef Label, const T &List) {
startLine() << Label << ": [";
bool Comma = false;
for (const auto &Item : List) {
OS << "]\n";
}
- template <typename T>
- void printHexList(StringRef Label, const T &List) {
+ template <typename T> void printHexList(StringRef Label, const T &List) {
startLine() << Label << ": [";
bool Comma = false;
for (const auto &Item : List) {
OS << "]\n";
}
- template<typename T>
- void printHex(StringRef Label, T Value) {
+ template <typename T> void printHex(StringRef Label, T Value) {
startLine() << Label << ": " << hex(Value) << "\n";
}
- template<typename T>
- void printHex(StringRef Label, StringRef Str, T Value) {
+ template <typename T> void printHex(StringRef Label, StringRef Str, T Value) {
startLine() << Label << ": " << Str << " (" << hex(Value) << ")\n";
}
startLine() << Label << ": " << Value << "\n";
}
- template<typename T>
+ template <typename T>
void printNumber(StringRef Label, StringRef Str, T Value) {
startLine() << Label << ": " << Str << " (" << Value << ")\n";
}
}
void printBinary(StringRef Label, StringRef Str, ArrayRef<char> Value) {
- auto V = makeArrayRef(reinterpret_cast<const uint8_t*>(Value.data()),
+ auto V = makeArrayRef(reinterpret_cast<const uint8_t *>(Value.data()),
Value.size());
printBinaryImpl(Label, Str, V, false);
}
}
void printBinary(StringRef Label, ArrayRef<char> Value) {
- auto V = makeArrayRef(reinterpret_cast<const uint8_t*>(Value.data()),
+ auto V = makeArrayRef(reinterpret_cast<const uint8_t *>(Value.data()),
Value.size());
printBinaryImpl(Label, StringRef(), V, false);
}
void printBinary(StringRef Label, StringRef Value) {
- auto V = makeArrayRef(reinterpret_cast<const uint8_t*>(Value.data()),
+ auto V = makeArrayRef(reinterpret_cast<const uint8_t *>(Value.data()),
Value.size());
printBinaryImpl(Label, StringRef(), V, false);
}
void printBinaryBlock(StringRef Label, StringRef Value) {
- auto V = makeArrayRef(reinterpret_cast<const uint8_t*>(Value.data()),
+ auto V = makeArrayRef(reinterpret_cast<const uint8_t *>(Value.data()),
Value.size());
printBinaryImpl(Label, StringRef(), V, true);
}
- raw_ostream& startLine() {
+ raw_ostream &startLine() {
printIndent();
return OS;
}
- raw_ostream& getOStream() {
- return OS;
- }
+ raw_ostream &getOStream() { return OS; }
private:
- template<typename T>
- static bool flagName(const EnumEntry<T>& lhs, const EnumEntry<T>& rhs) {
+ template <typename T>
+ static bool flagName(const EnumEntry<T> &lhs, const EnumEntry<T> &rhs) {
return lhs.Name < rhs.Name;
}
template <>
inline void
-StreamWriter::printHex<support::ulittle16_t>(StringRef Label,
- support::ulittle16_t Value) {
+ScopedPrinter::printHex<support::ulittle16_t>(StringRef Label,
+ support::ulittle16_t Value) {
startLine() << Label << ": " << hex(Value) << "\n";
}
struct DictScope {
- DictScope(StreamWriter& W, StringRef N) : W(W) {
+ DictScope(ScopedPrinter &W, StringRef N) : W(W) {
W.startLine() << N << " {\n";
W.indent();
}
W.startLine() << "}\n";
}
- StreamWriter& W;
+ ScopedPrinter &W;
};
struct ListScope {
- ListScope(StreamWriter& W, StringRef N) : W(W) {
+ ListScope(ScopedPrinter &W, StringRef N) : W(W) {
W.startLine() << N << " [\n";
W.indent();
}
W.startLine() << "]\n";
}
- StreamWriter& W;
+ ScopedPrinter &W;
};
} // namespace llvm
RandomNumberGenerator.cpp
Regex.cpp
ScaledNumber.cpp
+ ScopedPrinter.cpp
SHA1.cpp
SmallPtrSet.cpp
SmallVector.cpp
-#include "StreamWriter.h"
+#include "llvm/Support/ScopedPrinter.h"
+
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Format.h"
#include <cctype>
namespace llvm {
-raw_ostream &operator<<(raw_ostream &OS, const HexNumber& Value) {
+raw_ostream &operator<<(raw_ostream &OS, const HexNumber &Value) {
OS << "0x" << to_hexString(Value.Value);
return OS;
}
return stream.str();
}
-void StreamWriter::printBinaryImpl(StringRef Label, StringRef Str,
- ArrayRef<uint8_t> Data, bool Block) {
+void ScopedPrinter::printBinaryImpl(StringRef Label, StringRef Str,
+ ArrayRef<uint8_t> Data, bool Block) {
if (Data.size() > 16)
Block = true;
//===----------------------------------------------------------------------===//
#include "ARMAttributeParser.h"
-#include "StreamWriter.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/LEB128.h"
+#include "llvm/Support/ScopedPrinter.h"
using namespace llvm;
using namespace llvm::ARMBuildAttrs;
#ifndef LLVM_TOOLS_LLVM_READOBJ_ARMATTRIBUTEPARSER_H
#define LLVM_TOOLS_LLVM_READOBJ_ARMATTRIBUTEPARSER_H
-#include "StreamWriter.h"
#include "llvm/Support/ARMBuildAttributes.h"
+#include "llvm/Support/ScopedPrinter.h"
namespace llvm {
class StringRef;
class ARMAttributeParser {
- StreamWriter &SW;
+ ScopedPrinter &SW;
struct DisplayHandler {
ARMBuildAttrs::AttrType Attribute;
SmallVectorImpl<uint8_t> &IndexList);
void ParseSubsection(const uint8_t *Data, uint32_t Length);
public:
- ARMAttributeParser(StreamWriter &SW) : SW(SW) {}
+ ARMAttributeParser(ScopedPrinter &SW) : SW(SW) {}
void Parse(ArrayRef<uint8_t> Section);
};
#define LLVM_TOOLS_LLVM_READOBJ_ARMEHABIPRINTER_H
#include "Error.h"
-#include "StreamWriter.h"
#include "llvm-readobj.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Object/ELF.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Format.h"
+#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/type_traits.h"
namespace llvm {
namespace EHABI {
class OpcodeDecoder {
- StreamWriter &SW;
+ ScopedPrinter &SW;
raw_ostream &OS;
struct RingEntry {
void PrintRegisters(uint32_t Mask, StringRef Prefix);
public:
- OpcodeDecoder(StreamWriter &SW) : SW(SW), OS(SW.getOStream()) {}
+ OpcodeDecoder(ScopedPrinter &SW) : SW(SW), OS(SW.getOStream()) {}
void Decode(const uint8_t *Opcodes, off_t Offset, size_t Length);
};
typedef typename object::ELFFile<ET>::Elf_Rel Elf_Rel;
typedef typename object::ELFFile<ET>::Elf_Word Elf_Word;
- StreamWriter &SW;
+ ScopedPrinter &SW;
const object::ELFFile<ET> *ELF;
const Elf_Shdr *Symtab;
ArrayRef<Elf_Word> ShndxTable;
void PrintOpcodes(const uint8_t *Entry, size_t Length, off_t Offset) const;
public:
- PrinterContext(StreamWriter &SW, const object::ELFFile<ET> *ELF,
+ PrinterContext(ScopedPrinter &SW, const object::ELFFile<ET> *ELF,
const Elf_Shdr *Symtab)
: SW(SW), ELF(ELF), Symtab(Symtab) {}
#ifndef LLVM_TOOLS_LLVM_READOBJ_ARMWINEHPRINTER_H
#define LLVM_TOOLS_LLVM_READOBJ_ARMWINEHPRINTER_H
-#include "StreamWriter.h"
#include "llvm/Object/COFF.h"
#include "llvm/Support/ErrorOr.h"
+#include "llvm/Support/ScopedPrinter.h"
namespace llvm {
namespace ARM {
class Decoder {
static const size_t PDataEntrySize;
- StreamWriter &SW;
+ ScopedPrinter &SW;
raw_ostream &OS;
struct RingEntry {
const object::SectionRef Section);
public:
- Decoder(StreamWriter &SW) : SW(SW), OS(SW.getOStream()) {}
+ Decoder(ScopedPrinter &SW) : SW(SW), OS(SW.getOStream()) {}
std::error_code dumpProcedureData(const object::COFFObjectFile &COFF);
};
}
llvm-readobj.cpp
MachODumper.cpp
ObjDumper.cpp
- StreamWriter.cpp
Win64EHDumper.cpp
)
///
//===----------------------------------------------------------------------===//
-#include "llvm-readobj.h"
#include "ARMWinEHPrinter.h"
#include "CodeView.h"
#include "Error.h"
#include "ObjDumper.h"
#include "StackMapPrinter.h"
-#include "StreamWriter.h"
#include "Win64EHDumper.h"
+#include "llvm-readobj.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/Line.h"
+#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/COFF.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataExtractor.h"
#include "llvm/Support/Format.h"
+#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/Win64EH.h"
#include "llvm/Support/raw_ostream.h"
class CVTypeDumper {
public:
- CVTypeDumper(StreamWriter &W) : W(W) {}
+ CVTypeDumper(ScopedPrinter &W) : W(W) {}
StringRef getTypeName(TypeIndex TI);
void printTypeIndex(StringRef FieldName, TypeIndex TI);
void printCodeViewFieldList(StringRef FieldData);
void printMemberAttributes(MemberAttributes Attrs);
- StreamWriter &W;
+ ScopedPrinter &W;
/// All user defined type records in .debug$T live in here. Type indices
/// greater than 0x1000 are user defined. Subtract 0x1000 from the index to
class COFFDumper : public ObjDumper {
public:
- COFFDumper(const llvm::object::COFFObjectFile *Obj, StreamWriter &Writer)
+ COFFDumper(const llvm::object::COFFObjectFile *Obj, ScopedPrinter &Writer)
: ObjDumper(Writer), Obj(Obj), CVTD(Writer) {}
void printFileHeaders() override;
namespace llvm {
std::error_code createCOFFDumper(const object::ObjectFile *Obj,
- StreamWriter &Writer,
+ ScopedPrinter &Writer,
std::unique_ptr<ObjDumper> &Result) {
const COFFObjectFile *COFFObj = dyn_cast<COFFObjectFile>(Obj);
if (!COFFObj)
///
//===----------------------------------------------------------------------===//
-#include "llvm-readobj.h"
#include "ARMAttributeParser.h"
#include "ARMEHABIPrinter.h"
#include "Error.h"
#include "ObjDumper.h"
#include "StackMapPrinter.h"
-#include "StreamWriter.h"
+#include "llvm-readobj.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/ARMBuildAttributes.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Format.h"
+#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/MipsABIFlags.h"
+#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/Support/FormattedStream.h"
using namespace llvm;
using namespace llvm::object;
template<typename ELFT>
class ELFDumper : public ObjDumper {
public:
- ELFDumper(const ELFFile<ELFT> *Obj, StreamWriter &Writer);
+ ELFDumper(const ELFFile<ELFT> *Obj, ScopedPrinter &Writer);
void printFileHeaders() override;
void printSections() override;
formatted_raw_ostream OS;
public:
TYPEDEF_ELF_TYPES(ELFT)
- GNUStyle(StreamWriter &W, ELFDumper<ELFT> *Dumper)
+ GNUStyle(ScopedPrinter &W, ELFDumper<ELFT> *Dumper)
: DumpStyle<ELFT>(Dumper), OS(W.getOStream()) {}
void printFileHeaders(const ELFO *Obj) override;
void printGroupSections(const ELFFile<ELFT> *Obj) override;
template <typename ELFT> class LLVMStyle : public DumpStyle<ELFT> {
public:
TYPEDEF_ELF_TYPES(ELFT)
- LLVMStyle(StreamWriter &W, ELFDumper<ELFT> *Dumper)
+ LLVMStyle(ScopedPrinter &W, ELFDumper<ELFT> *Dumper)
: DumpStyle<ELFT>(Dumper), W(W) {}
void printFileHeaders(const ELFO *Obj) override;
void printDynamicRelocation(const ELFO *Obj, Elf_Rela Rel);
void printSymbol(const ELFO *Obj, const Elf_Sym *Symbol, const Elf_Sym *First,
StringRef StrTable, bool IsDynamic) override;
- StreamWriter &W;
+ ScopedPrinter &W;
};
} // namespace
template <class ELFT>
static std::error_code createELFDumper(const ELFFile<ELFT> *Obj,
- StreamWriter &Writer,
+ ScopedPrinter &Writer,
std::unique_ptr<ObjDumper> &Result) {
Result.reset(new ELFDumper<ELFT>(Obj, Writer));
return readobj_error::success;
}
std::error_code createELFDumper(const object::ObjectFile *Obj,
- StreamWriter &Writer,
+ ScopedPrinter &Writer,
std::unique_ptr<ObjDumper> &Result) {
// Little-endian 32-bit
if (const ELF32LEObjectFile *ELFObj = dyn_cast<ELF32LEObjectFile>(Obj))
LoadVersionNeeds(dot_gnu_version_r_sec);
}
-
template <typename ELFO, class ELFT>
-static void printVersionSymbolSection(ELFDumper<ELFT> *Dumper,
- const ELFO *Obj,
+static void printVersionSymbolSection(ELFDumper<ELFT> *Dumper, const ELFO *Obj,
const typename ELFO::Elf_Shdr *Sec,
- StreamWriter &W) {
+ ScopedPrinter &W) {
DictScope SS(W, "Version symbols");
if (!Sec)
return;
static void printVersionDefinitionSection(ELFDumper<ELFT> *Dumper,
const ELFO *Obj,
const typename ELFO::Elf_Shdr *Sec,
- StreamWriter &W) {
+ ScopedPrinter &W) {
DictScope SD(W, "Version definition");
if (!Sec)
return;
};
template <typename ELFT>
-ELFDumper<ELFT>::ELFDumper(const ELFFile<ELFT> *Obj, StreamWriter &Writer)
+ELFDumper<ELFT>::ELFDumper(const ELFFile<ELFT> *Obj, ScopedPrinter &Writer)
: ObjDumper(Writer), Obj(Obj) {
SmallVector<const Elf_Phdr *, 4> LoadSegments;
typedef typename ELFO::Elf_Rela Elf_Rela;
MipsGOTParser(ELFDumper<ELFT> *Dumper, const ELFO *Obj,
- Elf_Dyn_Range DynTable, StreamWriter &W);
+ Elf_Dyn_Range DynTable, ScopedPrinter &W);
void parseGOT();
void parsePLT();
private:
ELFDumper<ELFT> *Dumper;
const ELFO *Obj;
- StreamWriter &W;
+ ScopedPrinter &W;
llvm::Optional<uint64_t> DtPltGot;
llvm::Optional<uint64_t> DtLocalGotNum;
llvm::Optional<uint64_t> DtGotSym;
template <class ELFT>
MipsGOTParser<ELFT>::MipsGOTParser(ELFDumper<ELFT> *Dumper, const ELFO *Obj,
- Elf_Dyn_Range DynTable, StreamWriter &W)
+ Elf_Dyn_Range DynTable, ScopedPrinter &W)
: Dumper(Dumper), Obj(Obj), W(W) {
for (const auto &Entry : DynTable) {
switch (Entry.getTag()) {
//
//===----------------------------------------------------------------------===//
-#include "llvm-readobj.h"
#include "Error.h"
#include "ObjDumper.h"
#include "StackMapPrinter.h"
-#include "StreamWriter.h"
+#include "llvm-readobj.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Object/MachO.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/ScopedPrinter.h"
using namespace llvm;
using namespace object;
class MachODumper : public ObjDumper {
public:
- MachODumper(const MachOObjectFile *Obj, StreamWriter& Writer)
- : ObjDumper(Writer)
- , Obj(Obj) { }
+ MachODumper(const MachOObjectFile *Obj, ScopedPrinter &Writer)
+ : ObjDumper(Writer), Obj(Obj) {}
void printFileHeaders() override;
void printSections() override;
namespace llvm {
std::error_code createMachODumper(const object::ObjectFile *Obj,
- StreamWriter &Writer,
+ ScopedPrinter &Writer,
std::unique_ptr<ObjDumper> &Result) {
const MachOObjectFile *MachOObj = dyn_cast<MachOObjectFile>(Obj);
if (!MachOObj)
#include "ObjDumper.h"
#include "Error.h"
-#include "StreamWriter.h"
#include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
-ObjDumper::ObjDumper(StreamWriter& Writer)
- : W(Writer) {
-}
+ObjDumper::ObjDumper(ScopedPrinter &Writer) : W(Writer) {}
ObjDumper::~ObjDumper() {
}
class ObjectFile;
}
-class StreamWriter;
+class ScopedPrinter;
class ObjDumper {
public:
- ObjDumper(StreamWriter& Writer);
+ ObjDumper(ScopedPrinter &Writer);
virtual ~ObjDumper();
virtual void printFileHeaders() = 0;
virtual void printStackMap() const = 0;
protected:
- StreamWriter& W;
+ ScopedPrinter &W;
};
std::error_code createCOFFDumper(const object::ObjectFile *Obj,
- StreamWriter &Writer,
+ ScopedPrinter &Writer,
std::unique_ptr<ObjDumper> &Result);
std::error_code createELFDumper(const object::ObjectFile *Obj,
- StreamWriter &Writer,
+ ScopedPrinter &Writer,
std::unique_ptr<ObjDumper> &Result);
std::error_code createMachODumper(const object::ObjectFile *Obj,
- StreamWriter &Writer,
+ ScopedPrinter &Writer,
std::unique_ptr<ObjDumper> &Result);
void dumpCOFFImportFile(const object::COFFImportFile *File);
#ifndef LLVM_TOOLS_LLVM_READOBJ_WIN64EHDUMPER_H
#define LLVM_TOOLS_LLVM_READOBJ_WIN64EHDUMPER_H
-#include "StreamWriter.h"
+#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/Win64EH.h"
namespace llvm {
namespace Win64EH {
class Dumper {
- StreamWriter &SW;
+ ScopedPrinter &SW;
raw_ostream &OS;
public:
uint64_t SectionOffset, const RuntimeFunction &RF);
public:
- Dumper(StreamWriter &SW) : SW(SW), OS(SW.getOStream()) {}
+ Dumper(ScopedPrinter &SW) : SW(SW), OS(SW.getOStream()) {}
void printData(const Context &Ctx);
};
#include "llvm-readobj.h"
#include "Error.h"
#include "ObjDumper.h"
-#include "StreamWriter.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/COFFImportFile.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
}
/// @brief Creates an format-specific object file dumper.
-static std::error_code createDumper(const ObjectFile *Obj, StreamWriter &Writer,
+static std::error_code createDumper(const ObjectFile *Obj,
+ ScopedPrinter &Writer,
std::unique_ptr<ObjDumper> &Result) {
if (!Obj)
return readobj_error::unsupported_file_format;
/// @brief Dumps the specified object file.
static void dumpObject(const ObjectFile *Obj) {
- StreamWriter Writer(outs());
+ ScopedPrinter Writer(outs());
std::unique_ptr<ObjDumper> Dumper;
if (std::error_code EC = createDumper(Obj, Writer, Dumper))
reportError(Obj->getFileName(), EC);