aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Instruction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/Instruction.cpp')
-rw-r--r--lib/VMCore/Instruction.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp
index 6f2480bdde..b009c01eec 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