diff options
author | Adrian Prantl <aprantl@apple.com> | 2017-12-08 21:58:18 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2017-12-08 21:58:18 +0000 |
commit | 0375b237481336e505669b90d6ff6d8ae2f417ea (patch) | |
tree | f2f0a85b7b34e535c953c2d8947533069f82b230 /unittests | |
parent | 2cac108e9753326b180ea630bd6272eaacfe80a5 (diff) |
Generalize llvm::replaceDbgDeclare and actually support the use-case that
is mentioned in the documentation (inserting a deref before the plus_uconst).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320203 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/IR/MetadataTest.cpp | 12 | ||||
-rw-r--r-- | unittests/Transforms/Utils/Local.cpp | 3 |
2 files changed, 14 insertions, 1 deletions
diff --git a/unittests/IR/MetadataTest.cpp b/unittests/IR/MetadataTest.cpp index 76c19035a03..672de55fbde 100644 --- a/unittests/IR/MetadataTest.cpp +++ b/unittests/IR/MetadataTest.cpp @@ -2031,6 +2031,18 @@ TEST_F(DIExpressionTest, get) { TempDIExpression Temp = N->clone(); EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp))); + + // Test DIExpression::prepend(). + uint64_t Elts0[] = {dwarf::DW_OP_LLVM_fragment, 0, 32}; + auto *N0 = DIExpression::get(Context, Elts0); + N0 = DIExpression::prepend(N0, true, 64, true, true); + uint64_t Elts1[] = {dwarf::DW_OP_deref, + dwarf::DW_OP_plus_uconst, 64, + dwarf::DW_OP_deref, + dwarf::DW_OP_stack_value, + dwarf::DW_OP_LLVM_fragment, 0, 32}; + auto *N1 = DIExpression::get(Context, Elts1); + EXPECT_EQ(N0, N1); } TEST_F(DIExpressionTest, isValid) { diff --git a/unittests/Transforms/Utils/Local.cpp b/unittests/Transforms/Utils/Local.cpp index ee864e68fc0..4789b0558d7 100644 --- a/unittests/Transforms/Utils/Local.cpp +++ b/unittests/Transforms/Utils/Local.cpp @@ -157,7 +157,8 @@ TEST(Local, ReplaceDbgDeclare) { ASSERT_TRUE(DII); Value *NewBase = Constant::getNullValue(Type::getInt32PtrTy(C)); DIBuilder DIB(*M); - replaceDbgDeclare(AI, NewBase, DII, DIB, /*Deref=*/false, /*Offset=*/0); + replaceDbgDeclare(AI, NewBase, DII, DIB, DIExpression::NoDeref, 0, + DIExpression::NoDeref); // There should be exactly two dbg.declares. int Declares = 0; |