summaryrefslogtreecommitdiff
path: root/unittests/IR/MetadataTest.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <florian.hahn@arm.com>2017-06-13 16:54:44 +0000
committerFlorian Hahn <florian.hahn@arm.com>2017-06-13 16:54:44 +0000
commit10ccfa6a1e7efc62fb55961986ada2c442a17491 (patch)
tree6b51cfc743c865b94a934856e2a36cd1e623c941 /unittests/IR/MetadataTest.cpp
parent4ed42e9451bd7914c60672eb5beebc5c14a0122c (diff)
Align definition of DW_OP_plus with DWARF spec [1/3]
Summary: This patch is part of 3 patches that together form a single patch, but must be introduced in stages in order not to break things. The way that LLVM interprets DW_OP_plus in DIExpression nodes is basically that of the DW_OP_plus_uconst operator since LLVM expects an unsigned constant operand. This unnecessarily restricts the DW_OP_plus operator, preventing it from being used to describe the evaluation of runtime values on the expression stack. These patches try to align the semantics of DW_OP_plus and DW_OP_minus with that of the DWARF definition, which pops two elements off the expression stack, performs the operation and pushes the result back on the stack. This is done in three stages: • The first patch (LLVM) adds support for DW_OP_plus_uconst. • The second patch (Clang) contains changes all its uses from DW_OP_plus to DW_OP_plus_uconst. • The third patch (LLVM) changes the semantics of DW_OP_plus and DW_OP_minus to be in line with its DWARF meaning. This patch includes the bitcode upgrade from legacy DIExpressions. Patch by Sander de Smalen. Reviewers: pcc, echristo, aprantl Reviewed By: aprantl Subscribers: fhahn, aprantl, javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D33892 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305304 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/IR/MetadataTest.cpp')
-rw-r--r--unittests/IR/MetadataTest.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/unittests/IR/MetadataTest.cpp b/unittests/IR/MetadataTest.cpp
index bcf3babf7f6..a09a4239ec4 100644
--- a/unittests/IR/MetadataTest.cpp
+++ b/unittests/IR/MetadataTest.cpp
@@ -2043,6 +2043,7 @@ TEST_F(DIExpressionTest, isValid) {
// Valid constructions.
EXPECT_VALID(dwarf::DW_OP_plus, 6);
+ EXPECT_VALID(dwarf::DW_OP_plus_uconst, 6);
EXPECT_VALID(dwarf::DW_OP_deref);
EXPECT_VALID(dwarf::DW_OP_LLVM_fragment, 3, 7);
EXPECT_VALID(dwarf::DW_OP_plus, 6, dwarf::DW_OP_deref);
@@ -2054,6 +2055,7 @@ TEST_F(DIExpressionTest, isValid) {
// Invalid constructions.
EXPECT_INVALID(~0u);
EXPECT_INVALID(dwarf::DW_OP_plus);
+ EXPECT_INVALID(dwarf::DW_OP_plus_uconst);
EXPECT_INVALID(dwarf::DW_OP_LLVM_fragment);
EXPECT_INVALID(dwarf::DW_OP_LLVM_fragment, 3);
EXPECT_INVALID(dwarf::DW_OP_LLVM_fragment, 3, 7, dwarf::DW_OP_plus, 3);