Driver: Free jobs in JobList and PipedJob instances.

llvm-svn: 98261
This commit is contained in:
Daniel Dunbar 2010-03-11 18:04:49 +00:00
parent 103e3ef893
commit 66e2768918
2 changed files with 14 additions and 0 deletions

View File

@ -100,7 +100,9 @@ private:
public:
PipedJob();
virtual ~PipedJob();
/// Add a command to the piped job (taking ownership).
void addCommand(Command *C) { Commands.push_back(C); }
const list_type &getCommands() const { return Commands; }
@ -130,7 +132,9 @@ private:
public:
JobList();
virtual ~JobList();
/// Add a job to the list (taking ownership).
void addJob(Job *J) { Jobs.push_back(J); }
const list_type &getJobs() const { return Jobs; }

View File

@ -23,8 +23,18 @@ Command::Command(const Action &_Source, const Tool &_Creator,
PipedJob::PipedJob() : Job(PipedJobClass) {}
PipedJob::~PipedJob() {
for (iterator it = begin(), ie = end(); it != ie; ++it)
delete *it;
}
JobList::JobList() : Job(JobListClass) {}
JobList::~JobList() {
for (iterator it = begin(), ie = end(); it != ie; ++it)
delete *it;
}
void Job::addCommand(Command *C) {
if (PipedJob *PJ = dyn_cast<PipedJob>(this))
PJ->addCommand(C);