1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[BinaryFormat] Add formatv support for DW_OP constants

The functionality will be used from lldb.
This commit is contained in:
Pavel Labath 2020-06-08 15:24:17 +02:00
parent 2fe95a24b3
commit e6c55932ca
3 changed files with 8 additions and 0 deletions

View File

@ -669,6 +669,11 @@ template <> struct EnumTraits<LineNumberOps> : public std::true_type {
static constexpr char Type[4] = "LNS";
static constexpr StringRef (*StringFn)(unsigned) = &LNStandardString;
};
template <> struct EnumTraits<LocationAtom> : public std::true_type {
static constexpr char Type[3] = "OP";
static constexpr StringRef (*StringFn)(unsigned) = &OperationEncodingString;
};
} // End of namespace dwarf
/// Dwarf constants format_provider

View File

@ -789,3 +789,4 @@ constexpr char llvm::dwarf::EnumTraits<Form>::Type[];
constexpr char llvm::dwarf::EnumTraits<Index>::Type[];
constexpr char llvm::dwarf::EnumTraits<Tag>::Type[];
constexpr char llvm::dwarf::EnumTraits<LineNumberOps>::Type[];
constexpr char llvm::dwarf::EnumTraits<LocationAtom>::Type[];

View File

@ -201,5 +201,7 @@ TEST(DwarfTest, format_provider) {
EXPECT_EQ("DW_IDX_unknown_3fff", formatv("{0}", DW_IDX_hi_user).str());
EXPECT_EQ("DW_TAG_compile_unit", formatv("{0}", DW_TAG_compile_unit).str());
EXPECT_EQ("DW_TAG_unknown_ffff", formatv("{0}", DW_TAG_hi_user).str());
EXPECT_EQ("DW_OP_lit0", formatv("{0}", DW_OP_lit0).str());
EXPECT_EQ("DW_OP_unknown_ff", formatv("{0}", DW_OP_hi_user).str());
}
} // end namespace