summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-04 01:06:38 +0000
committerChris Lattner <sabre@nondot.org>2004-02-04 01:06:38 +0000
commitd8a232b716412d536f3340e7e7e6be82bd0669df (patch)
treea009d9a8f1ac89a1500476d0f92080d8d6b500af /llvm/lib
parentc4c7ea5288a61a87605f22c351d3126165cb73ff (diff)
downloadbcm5719-llvm-d8a232b716412d536f3340e7e7e6be82bd0669df.tar.gz
bcm5719-llvm-d8a232b716412d536f3340e7e7e6be82bd0669df.zip
If changing a parent, don't add then remove the object from the leak detector
llvm-svn: 11106
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/Instruction.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/VMCore/Instruction.cpp b/llvm/lib/VMCore/Instruction.cpp
index 6f2480bdde7..b009c01eecb 100644
--- a/llvm/lib/VMCore/Instruction.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud