From 06fdaccc89d9abdc7e03797b25173791a2f5692f Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Thu, 18 Feb 2010 20:53:16 +0000 Subject: Destroy MDNodes gracefully while deleting llvm context. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96609 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Metadata.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/llvm/Metadata.h') diff --git a/include/llvm/Metadata.h b/include/llvm/Metadata.h index 4e459bf..0369f5e 100644 --- a/include/llvm/Metadata.h +++ b/include/llvm/Metadata.h @@ -75,6 +75,7 @@ class MDNode : public Value, public FoldingSetNode { MDNode(const MDNode &); // DO NOT IMPLEMENT void operator=(const MDNode &); // DO NOT IMPLEMENT friend class MDNodeOperand; + friend class LLVMContextImpl; /// NumOperands - This many 'MDNodeOperand' items are co-allocated onto the /// end of this MDNode. @@ -106,6 +107,9 @@ class MDNode : public Value, public FoldingSetNode { // Replace each instance of F from the operand list of this node with T. void replaceOperand(MDNodeOperand *Op, Value *NewVal); ~MDNode(); + // replaceAllOperandsWithNull - This is used while destroying llvm context to + // gracefully delete all nodes. This method replaces all operands with null. + void replaceAllOperandsWithNull(); protected: explicit MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals, -- cgit v1.1