[cfe-commits] r67146 - in /cfe/trunk/lib/Driver: Driver.cpp HostInfo.cpp ToolChains.h

Daniel Dunbar daniel at zuster.org
Tue Mar 17 18:09:41 PDT 2009


Author: ddunbar
Date: Tue Mar 17 20:09:40 2009
New Revision: 67146

URL: http://llvm.org/viewvc/llvm-project?rev=67146&view=rev
Log:
Driver: Release Host, ToolChain, and Tool implementations.

Modified:
    cfe/trunk/lib/Driver/Driver.cpp
    cfe/trunk/lib/Driver/HostInfo.cpp
    cfe/trunk/lib/Driver/ToolChains.h

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=67146&r1=67145&r2=67146&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Mar 17 20:09:40 2009
@@ -48,6 +48,7 @@
 
 Driver::~Driver() {
   delete Opts;
+  delete Host;
 }
 
 ArgList *Driver::ParseArgStrings(const char **ArgBegin, const char **ArgEnd) {

Modified: cfe/trunk/lib/Driver/HostInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/HostInfo.cpp?rev=67146&r1=67145&r2=67146&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/HostInfo.cpp (original)
+++ cfe/trunk/lib/Driver/HostInfo.cpp Tue Mar 17 20:09:40 2009
@@ -46,11 +46,12 @@
   unsigned GCCVersion[3];
 
   /// Cache of tool chains we have created.
-  mutable llvm::StringMap<ToolChain*> ToolChains;
+  mutable llvm::StringMap<ToolChain *> ToolChains;
 
 public:
   DarwinHostInfo(const Driver &D, const char *Arch, 
                  const char *Platform, const char *OS);
+  ~DarwinHostInfo();
 
   virtual bool useDriverDriver() const;
 
@@ -74,6 +75,12 @@
   GCCVersion[2] = 1;
 }
 
+DarwinHostInfo::~DarwinHostInfo() {
+  for (llvm::StringMap<ToolChain*>::iterator
+         it = ToolChains.begin(), ie = ToolChains.end(); it != ie; ++it)
+    delete it->second;
+}
+
 bool DarwinHostInfo::useDriverDriver() const { 
   return true;
 }
@@ -122,6 +129,7 @@
 public:
   UnknownHostInfo(const Driver &D, const char *Arch, 
                   const char *Platform, const char *OS);
+  ~UnknownHostInfo();
 
   virtual bool useDriverDriver() const;
 
@@ -134,6 +142,12 @@
   : HostInfo(D, Arch, Platform, OS) {
 }
 
+UnknownHostInfo::~UnknownHostInfo() {
+  for (llvm::StringMap<ToolChain*>::iterator
+         it = ToolChains.begin(), ie = ToolChains.end(); it != ie; ++it)
+    delete it->second;
+}
+
 bool UnknownHostInfo::useDriverDriver() const { 
   return false;
 }

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=67146&r1=67145&r2=67146&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Tue Mar 17 20:09:40 2009
@@ -31,6 +31,12 @@
 public:
   Generic_GCC(const HostInfo &Host, const char *Arch, const char *Platform, 
               const char *OS) : ToolChain(Host, Arch, Platform, OS) {}
+  ~Generic_GCC() {
+    // Free tool implementations.
+    for (llvm::DenseMap<unsigned, Tool*>::iterator 
+           it = Tools.begin(), ie = Tools.end(); it != ie; ++it) 
+      delete it->second;
+  }
 
   virtual ArgList *TranslateArgs(ArgList &Args) const { return &Args; }
 





More information about the cfe-commits mailing list