Fix a nasty memory leak, caused by my revamp of the value symbol table.
llvm-svn: 35195
diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp
index 8bc99a8..790ae17 100644
--- a/llvm/lib/VMCore/Value.cpp
+++ b/llvm/lib/VMCore/Value.cpp
@@ -56,6 +56,11 @@
#endif
assert(use_begin() == use_end() && "Uses remain when a value is destroyed!");
+ // If this value is named, destroy the name. This should not be in a symtab
+ // at this point.
+ if (Name)
+ Name->Destroy();
+
// There should be no uses of this object anymore, remove it.
LeakDetector::removeGarbageObject(this);
}