summaryrefslogtreecommitdiff
path: root/unittests/IR
diff options
context:
space:
mode:
authorMomchil Velikov <momchil.velikov@arm.com>2018-02-07 16:46:33 +0000
committerMomchil Velikov <momchil.velikov@arm.com>2018-02-07 16:46:33 +0000
commita3b503f0223b8e57297bce071ad6f1dca245171b (patch)
tree28f47d4dc3cf878a7ba1fd67901238383e11da49 /unittests/IR
parent3afd566557f3616881505db0d69f5d19bf55ae14 (diff)
[DebugInfo] Improvements to representation of enumeration types (PR36168)
This patch is the LLVM part of fixing the issues, described in https://bugs.llvm.org/show_bug.cgi?id=36168 * The representation of enumerator values in the debug info metadata now contains a boolean flag isUnsigned, which determines how the bits of the value are interpreted. * The DW_TAG_enumeration type DIE now always (for DWARF version >= 3) includes a DW_AT_type attribute, which refers to the underlying integer type, as suggested in DWARFv4 (5.7 Enumeration Type Entries). * The debug info metadata for enumeration type contains (in flags) indication whether this is a C++11 "fixed enum". * For C++11 enumeration with a fixed underlying type, the DIE also includes the DW_AT_enum_class attribute (for DWARF version >= 4). * Encoding of enumerator constants uses DW_FORM_sdata for signed values and DW_FORM_udata for unsigned values, as suggested by DWARFv4 (7.5.4 Attribute Encodings). The changes should be backwards compatible: * the isUnsigned attribute is optional and defaults to false. * if the underlying type for the enumeration is not available, the enumerator values are considered signed. * the FixedEnum flag defaults to clear. * the bitcode format for DIEnumerator stores the unsigned flag bit #1 of the first record element, so the format does not change and the zero previously stored there is consistent with the false default for IsUnsigned. Differential Revision: https://reviews.llvm.org/D42734 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324489 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/IR')
-rw-r--r--unittests/IR/MetadataTest.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/unittests/IR/MetadataTest.cpp b/unittests/IR/MetadataTest.cpp
index 548456cc501..6c16951f851 100644
--- a/unittests/IR/MetadataTest.cpp
+++ b/unittests/IR/MetadataTest.cpp
@@ -978,14 +978,16 @@ TEST_F(DISubrangeTest, getVariableCount) {
typedef MetadataTest DIEnumeratorTest;
TEST_F(DIEnumeratorTest, get) {
- auto *N = DIEnumerator::get(Context, 7, "name");
+ auto *N = DIEnumerator::get(Context, 7, false, "name");
EXPECT_EQ(dwarf::DW_TAG_enumerator, N->getTag());
EXPECT_EQ(7, N->getValue());
+ EXPECT_EQ(false, N->isUnsigned());
EXPECT_EQ("name", N->getName());
- EXPECT_EQ(N, DIEnumerator::get(Context, 7, "name"));
+ EXPECT_EQ(N, DIEnumerator::get(Context, 7, false, "name"));
- EXPECT_NE(N, DIEnumerator::get(Context, 8, "name"));
- EXPECT_NE(N, DIEnumerator::get(Context, 7, "nam"));
+ EXPECT_NE(N, DIEnumerator::get(Context, 7, true, "name"));
+ EXPECT_NE(N, DIEnumerator::get(Context, 8, false, "name"));
+ EXPECT_NE(N, DIEnumerator::get(Context, 7, false, "nam"));
TempDIEnumerator Temp = N->clone();
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));