From 740506d9cad281ffb7ea02fd5ad9800f5f1e2843 Mon Sep 17 00:00:00 2001 From: Frederic Riss Date: Mon, 15 Sep 2014 07:50:42 +0000 Subject: [PATCH] Fix DebugInfo replaceAllUsesWith. Summary: replaceAllUsesWith had been modified to allow a DbgNode value to be replaced by itself. In that case a new node is created by copying the current DbgNode and the copy is used as replacement value. When that copying happens, the value stored in this->DbgNode at the end of RAUW would be a reference to the Node that has just been deleted. This doesn't produce any bug right now, because the DI node on which we call RAUW won't be used again. Reviewers: dblaikie, echristo, aprantl Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5326 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217749 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/DebugInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index 71c32fc969d..4274d82d158 100644 --- a/lib/IR/DebugInfo.cpp +++ b/lib/IR/DebugInfo.cpp @@ -384,7 +384,7 @@ void DIDescriptor::replaceAllUsesWith(LLVMContext &VMContext, DIDescriptor D) { const Value *V = cast_or_null(DN); Node->replaceAllUsesWith(const_cast(V)); MDNode::deleteTemporary(Node); - DbgNode = D; + DbgNode = DN; } /// replaceAllUsesWith - Replace all uses of the MDNode used by this