[llvm-commits] [llvm] r82647 - /llvm/trunk/lib/VMCore/Instruction.cpp

Devang Patel dpatel at apple.com
Wed Sep 23 15:33:52 CDT 2009


Author: dpatel
Date: Wed Sep 23 15:33:51 2009
New Revision: 82647

URL: http://llvm.org/viewvc/llvm-project?rev=82647&view=rev
Log:
Delete attached metadata when an instruction is deleted.

Modified:
    llvm/trunk/lib/VMCore/Instruction.cpp

Modified: llvm/trunk/lib/VMCore/Instruction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instruction.cpp?rev=82647&r1=82646&r2=82647&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Instruction.cpp (original)
+++ llvm/trunk/lib/VMCore/Instruction.cpp Wed Sep 23 15:33:51 2009
@@ -11,6 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "LLVMContextImpl.h"
 #include "llvm/Type.h"
 #include "llvm/Instructions.h"
 #include "llvm/Function.h"
@@ -49,6 +50,10 @@
 
 // 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!");
 }
 





More information about the llvm-commits mailing list