summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp')
-rw-r--r--llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
index 14550b9082b..c552623a786 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
@@ -160,6 +160,18 @@ TEST(DWARFFormValue, SignedConstantForms) {
EXPECT_EQ(LEBMax.getAsSignedConstant().getValue(), LLONG_MAX);
EXPECT_EQ(LEB1.getAsSignedConstant().getValue(), -42);
EXPECT_EQ(LEB2.getAsSignedConstant().getValue(), 42);
+
+ // Data16 is a little tricky.
+ char Cksum[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+ DWARFFormValue Data16(DW_FORM_data16);
+ DWARFDataExtractor DE16(StringRef(Cksum, 16), sys::IsLittleEndianHost,
+ sizeof(void *));
+ uint32_t Offset = 0;
+ Data16.extractValue(DE16, &Offset, {0, 0, dwarf::DwarfFormat::DWARF32});
+ SmallString<32> Str;
+ raw_svector_ostream Res(Str);
+ Data16.dump(Res, DIDumpOptions());
+ EXPECT_EQ(memcmp(Str.data(), "000102030405060708090a0b0c0d0e0f", 32), 0);
}
} // end anonymous namespace
OpenPOWER on IntegriCloud