diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2010-03-13 01:26:15 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2010-03-13 01:26:15 +0000 |
commit | 2cc2476198bf3f8a643d32da500f32bca8d715e1 (patch) | |
tree | ff3ad830329d893146dcfc089f122712a6f6f74c /llvm/lib/VMCore/Metadata.cpp | |
parent | 947f04bad0eddbb214aa31f34e7e4af1cc3ac109 (diff) | |
download | bcm5719-llvm-2cc2476198bf3f8a643d32da500f32bca8d715e1.tar.gz bcm5719-llvm-2cc2476198bf3f8a643d32da500f32bca8d715e1.zip |
Delete MDNodes when LLVMContext is destroyed. Previous attempts: r97918, r97788.
Tested: clang debug bootstrap, llvm-gcc bootstrap, `make check-lit`
after configuring with --with-llvmgccdir (and this did run the
FrontendC* tests this time)
llvm-svn: 98410
Diffstat (limited to 'llvm/lib/VMCore/Metadata.cpp')
-rw-r--r-- | llvm/lib/VMCore/Metadata.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/VMCore/Metadata.cpp b/llvm/lib/VMCore/Metadata.cpp index 379aeb540a1..06d4fd4ae5c 100644 --- a/llvm/lib/VMCore/Metadata.cpp +++ b/llvm/lib/VMCore/Metadata.cpp @@ -101,8 +101,10 @@ MDNode::MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals, MDNode::~MDNode() { assert((getSubclassDataFromValue() & DestroyFlag) != 0 && "Not being destroyed through destroy()?"); - if (!isNotUniqued()) { - LLVMContextImpl *pImpl = getType()->getContext().pImpl; + LLVMContextImpl *pImpl = getType()->getContext().pImpl; + if (isNotUniqued()) { + pImpl->NonUniquedMDNodes.erase(this); + } else { pImpl->MDNodeSet.RemoveNode(this); } @@ -248,12 +250,10 @@ void MDNode::Profile(FoldingSetNodeID &ID) const { ID.AddPointer(getOperand(i)); } -// replaceAllOperandsWithNull - This is used while destroying llvm context to -// gracefully delete all nodes. This method replaces all operands with null. -void MDNode::replaceAllOperandsWithNull() { - for (MDNodeOperand *Op = getOperandPtr(this, 0), *E = Op+NumOperands; - Op != E; ++Op) - replaceOperand(Op, 0); +void MDNode::setIsNotUniqued() { + setValueSubclassData(getSubclassDataFromValue() | NotUniquedBit); + LLVMContextImpl *pImpl = getType()->getContext().pImpl; + pImpl->NonUniquedMDNodes.insert(this); } // Replace value from this node's operand list. |