[llvm-commits] CVS: llvm/lib/VMCore/Instruction.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Feb 3 19:07:01 PST 2004


Changes in directory llvm/lib/VMCore:

Instruction.cpp updated: 1.33 -> 1.34

---
Log message:

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


---
Diffs of the changes:  (+5 -5)

Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.33 llvm/lib/VMCore/Instruction.cpp:1.34
--- llvm/lib/VMCore/Instruction.cpp:1.33	Mon Jan 12 17:18:25 2004
+++ llvm/lib/VMCore/Instruction.cpp	Tue Feb  3 19:06:38 2004
@@ -35,13 +35,13 @@
 }
 
 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





More information about the llvm-commits mailing list