aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-09-23 20:33:51 +0000
committerDevang Patel <dpatel@apple.com>2009-09-23 20:33:51 +0000
commit579edbf7bf65497e3afa498baaf1cb6642ef3de0 (patch)
treed2433c2dc7de8f41bf250b9070e0826f3fbc58ef
parent3fad552803d264b6bf83981de305e7080cb8ef4f (diff)
downloadexternal_llvm-579edbf7bf65497e3afa498baaf1cb6642ef3de0.zip
external_llvm-579edbf7bf65497e3afa498baaf1cb6642ef3de0.tar.gz
external_llvm-579edbf7bf65497e3afa498baaf1cb6642ef3de0.tar.bz2
Delete attached metadata when an instruction is deleted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82647 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/Instruction.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp
index 35fb47a..5cb1040 100644
--- a/lib/VMCore/Instruction.cpp
+++ b/lib/VMCore/Instruction.cpp
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#include "LLVMContextImpl.h"
#include "llvm/Type.h"
#include "llvm/Instructions.h"
#include "llvm/Function.h"
@@ -49,6 +50,10 @@ Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
// Out of line virtual method, so the vtable, etc has a home.
Instruction::~Instruction() {
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsDeleted(this);
+ }
assert(Parent == 0 && "Instruction still linked in the program!");
}