Free all Constants in ~LLVMConstantImpl.  We avoid assertion failures
by dropping all references from all constants that can use other
constants before trying to destroy any of them.

I also had to free bugpoint's Module in ~BugDriver().



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99160 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp
index 813c96c..024d8e2 100644
--- a/tools/bugpoint/BugDriver.cpp
+++ b/tools/bugpoint/BugDriver.cpp
@@ -75,6 +75,10 @@
     run_as_child(as_child), run_find_bugs(find_bugs), Timeout(timeout), 
     MemoryLimit(memlimit), UseValgrind(use_valgrind) {}
 
+BugDriver::~BugDriver() {
+  delete Program;
+}
+
 
 /// ParseInputFile - Given a bitcode or assembly input filename, parse and
 /// return it, or return null if not possible.