diff options
| author | Reid Kleckner <rnk@google.com> | 2017-05-09 19:59:29 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2017-05-09 19:59:29 +0000 |
| commit | b5fced732416c1d9a2ffa1980ca1af88c06edd83 (patch) | |
| tree | be7f854f4fcb5399e43b0ae77e0a09b625dfbb66 /llvm/lib/IR | |
| parent | dfa7f613ed7ca025d6d4d2ea85073f6ddaa9f712 (diff) | |
| download | bcm5719-llvm-b5fced732416c1d9a2ffa1980ca1af88c06edd83.tar.gz bcm5719-llvm-b5fced732416c1d9a2ffa1980ca1af88c06edd83.zip | |
[codeview] Check for a DIExpression offset for local variables
Fixes inalloca parameters, which previously all pointed to the same
offset. Extend the test to use llvm-readobj so that we can test the
offset in a readable way.
llvm-svn: 302578
Diffstat (limited to 'llvm/lib/IR')
| -rw-r--r-- | llvm/lib/IR/DebugInfoMetadata.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index cdbe237766a..e6c49cad072 100644 --- a/llvm/lib/IR/DebugInfoMetadata.cpp +++ b/llvm/lib/IR/DebugInfoMetadata.cpp @@ -672,6 +672,24 @@ void DIExpression::appendOffset(SmallVectorImpl<uint64_t> &Ops, } } +bool DIExpression::extractIfOffset(int64_t &Offset) const { + if (getNumElements() == 0) { + Offset = 0; + return true; + } + if (getNumElements() != 2) + return false; + if (Elements[0] == dwarf::DW_OP_plus) { + Offset = Elements[1]; + return true; + } + if (Elements[0] == dwarf::DW_OP_minus) { + Offset = -Elements[1]; + return true; + } + return false; +} + DIExpression *DIExpression::prepend(const DIExpression *Expr, bool Deref, int64_t Offset, bool StackValue) { SmallVector<uint64_t, 8> Ops; |

