Driver: Release Host, ToolChain, and Tool implementations.

llvm-svn: 67146
This commit is contained in:
Daniel Dunbar 2009-03-18 01:09:40 +00:00
parent 8af7837b08
commit 0160172228
3 changed files with 22 additions and 1 deletions

View File

@ -48,6 +48,7 @@ Driver::Driver(const char *_Name, const char *_Dir,
Driver::~Driver() {
delete Opts;
delete Host;
}
ArgList *Driver::ParseArgStrings(const char **ArgBegin, const char **ArgEnd) {

View File

@ -46,11 +46,12 @@ class DarwinHostInfo : public HostInfo {
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 @@ DarwinHostInfo::DarwinHostInfo(const Driver &D, const char *_Arch,
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 @@ class UnknownHostInfo : public HostInfo {
public:
UnknownHostInfo(const Driver &D, const char *Arch,
const char *Platform, const char *OS);
~UnknownHostInfo();
virtual bool useDriverDriver() const;
@ -134,6 +142,12 @@ UnknownHostInfo::UnknownHostInfo(const Driver &D, const char *Arch,
: 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;
}

View File

@ -31,6 +31,12 @@ class VISIBILITY_HIDDEN Generic_GCC : public ToolChain {
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; }