1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[DebugInfo] Extract a helper function to return the DWARF format name, NFC [1/10]

Differential Revision: https://reviews.llvm.org/D80523
This commit is contained in:
Igor Kudrin 2020-06-02 12:16:51 +07:00
parent a8cef06f62
commit bdb1b1e624
3 changed files with 12 additions and 1 deletions

View File

@ -481,6 +481,7 @@ StringRef AtomTypeString(unsigned Atom);
StringRef GDBIndexEntryKindString(GDBIndexEntryKind Kind);
StringRef GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage);
StringRef IndexString(unsigned Idx);
StringRef FormatString(DwarfFormat Format);
/// @}
/// \defgroup DwarfConstantsParsing Dwarf constants parsing functions

View File

@ -770,6 +770,16 @@ bool llvm::dwarf::isValidFormForVersion(Form F, unsigned Version,
return ExtensionsOk;
}
StringRef llvm::dwarf::FormatString(DwarfFormat Format) {
switch (Format) {
case DWARF32:
return "DWARF32";
case DWARF64:
return "DWARF64";
}
return StringRef();
}
constexpr char llvm::dwarf::EnumTraits<Attribute>::Type[];
constexpr char llvm::dwarf::EnumTraits<Form>::Type[];
constexpr char llvm::dwarf::EnumTraits<Index>::Type[];

View File

@ -190,7 +190,7 @@ static void dumpStringOffsetsSection(raw_ostream &OS, DIDumpOptions DumpOpts,
// version field and the padding, a total of 4 bytes). Add them back in
// for reporting.
OS << "Contribution size = " << (Contribution->Size + (Version < 5 ? 0 : 4))
<< ", Format = " << (Format == DWARF32 ? "DWARF32" : "DWARF64")
<< ", Format = " << dwarf::FormatString(Format)
<< ", Version = " << Version << "\n";
Offset = Contribution->Base;