Enable "garbage detection" of LLVM objects. Now users should be obnoxious
warnings. If they accidentally leak LLVM Value's.
llvm-svn: 3620
diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp
index ad2b180..402171b 100644
--- a/llvm/lib/VMCore/Value.cpp
+++ b/llvm/lib/VMCore/Value.cpp
@@ -7,6 +7,7 @@
#include "llvm/InstrTypes.h"
#include "llvm/SymbolTable.h"
#include "llvm/DerivedTypes.h"
+#include "Support/LeakDetector.h"
#include <algorithm>
//===----------------------------------------------------------------------===//
@@ -39,6 +40,9 @@
}
#endif
assert(Uses.begin() == Uses.end());
+
+ // There should be no uses of this object anymore, remove it.
+ LeakDetector::removeGarbageObject(this);
}
void Value::replaceAllUsesWith(Value *D) {