diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-04 01:06:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-04 01:06:38 +0000 |
commit | 786993c01ec8bdabe354fb62a083fedc9d7a087e (patch) | |
tree | 1e37ff083d63aa94f73fe93c8a8fdb2821b849c2 /lib/VMCore | |
parent | f2c3106866137b0c06e99f453a83d9558c0c6934 (diff) | |
download | external_llvm-786993c01ec8bdabe354fb62a083fedc9d7a087e.zip external_llvm-786993c01ec8bdabe354fb62a083fedc9d7a087e.tar.gz external_llvm-786993c01ec8bdabe354fb62a083fedc9d7a087e.tar.bz2 |
If changing a parent, don't add then remove the object from the leak detector
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11106 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Instruction.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp index 6f2480b..b009c01 100644 --- a/lib/VMCore/Instruction.cpp +++ b/lib/VMCore/Instruction.cpp @@ -35,13 +35,13 @@ Instruction::Instruction(const Type *ty, unsigned it, const std::string &Name, } void Instruction::setParent(BasicBlock *P) { - if (getParent()) - LeakDetector::addGarbageObject(this); + if (getParent()) { + if (!P) LeakDetector::addGarbageObject(this); + } else { + if (P) LeakDetector::removeGarbageObject(this); + } Parent = P; - - if (getParent()) - LeakDetector::removeGarbageObject(this); } // Specialize setName to take care of symbol table majik |