[cfe-commits] r98261 - in /cfe/trunk: include/clang/Driver/Job.h lib/Driver/Job.cpp
Daniel Dunbar
daniel at zuster.org
Thu Mar 11 10:04:49 PST 2010
Author: ddunbar
Date: Thu Mar 11 12:04:49 2010
New Revision: 98261
URL: http://llvm.org/viewvc/llvm-project?rev=98261&view=rev
Log:
Driver: Free jobs in JobList and PipedJob instances.
Modified:
cfe/trunk/include/clang/Driver/Job.h
cfe/trunk/lib/Driver/Job.cpp
Modified: cfe/trunk/include/clang/Driver/Job.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Job.h?rev=98261&r1=98260&r2=98261&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Job.h (original)
+++ cfe/trunk/include/clang/Driver/Job.h Thu Mar 11 12:04:49 2010
@@ -100,7 +100,9 @@
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 @@
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; }
Modified: cfe/trunk/lib/Driver/Job.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Job.cpp?rev=98261&r1=98260&r2=98261&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Job.cpp (original)
+++ cfe/trunk/lib/Driver/Job.cpp Thu Mar 11 12:04:49 2010
@@ -23,8 +23,18 @@
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);
More information about the cfe-commits
mailing list