diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-10-09 08:13:15 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-10-09 08:13:15 +0000 |
commit | 3b861ec9898150947d023c6288c9a6e170df8ef3 (patch) | |
tree | 5c11e2d23b6cd1b71d56a55a09d1dc2f2ee3e31c /llvm/lib/VMCore/DebugInfo.cpp | |
parent | 0597c1e53cc9e773eff07746df271cd035cc5bd2 (diff) | |
download | bcm5719-llvm-3b861ec9898150947d023c6288c9a6e170df8ef3.tar.gz bcm5719-llvm-3b861ec9898150947d023c6288c9a6e170df8ef3.zip |
Fix PR14016.
DeadArgumentElimination pass can replace one LLVM function with another,
invalidating a pointer stored in debug info metadata entry for this function.
To fix this, we collect debug info descriptors for functions before
running a DeadArgumentElimination pass and "patch" pointers in metadata nodes
if we replace a function.
llvm-svn: 165490
Diffstat (limited to 'llvm/lib/VMCore/DebugInfo.cpp')
-rw-r--r-- | llvm/lib/VMCore/DebugInfo.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/DebugInfo.cpp b/llvm/lib/VMCore/DebugInfo.cpp index c8f8f7d67b8..3029ce27343 100644 --- a/llvm/lib/VMCore/DebugInfo.cpp +++ b/llvm/lib/VMCore/DebugInfo.cpp @@ -111,6 +111,16 @@ Function *DIDescriptor::getFunctionField(unsigned Elt) const { return 0; } +void DIDescriptor::replaceFunctionField(unsigned Elt, Function *F) { + if (DbgNode == 0) + return; + + if (Elt < DbgNode->getNumOperands()) { + MDNode *Node = const_cast<MDNode*>(DbgNode); + Node->replaceOperandWith(Elt, F); + } +} + unsigned DIVariable::getNumAddrElements() const { if (getVersion() <= LLVMDebugVersion8) return DbgNode->getNumOperands()-6; |