If changing a parent, don't add then remove the object from the leak detector

llvm-svn: 11106
This commit is contained in:
Chris Lattner 2004-02-04 01:06:38 +00:00
parent c4c7ea5288
commit d8a232b716
1 changed files with 5 additions and 5 deletions

View File

@ -35,13 +35,13 @@ Instruction::Instruction(const Type *ty, unsigned it, const std::string &Name,
} }
void Instruction::setParent(BasicBlock *P) { void Instruction::setParent(BasicBlock *P) {
if (getParent()) if (getParent()) {
LeakDetector::addGarbageObject(this); if (!P) LeakDetector::addGarbageObject(this);
} else {
if (P) LeakDetector::removeGarbageObject(this);
}
Parent = P; Parent = P;
if (getParent())
LeakDetector::removeGarbageObject(this);
} }
// Specialize setName to take care of symbol table majik // Specialize setName to take care of symbol table majik