]> granicus.if.org Git - clang/commitdiff
Driver: Free jobs in JobList and PipedJob instances.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 11 Mar 2010 18:04:49 +0000 (18:04 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 11 Mar 2010 18:04:49 +0000 (18:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98261 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Job.h
lib/Driver/Job.cpp

index 74ca083417a6e9c025148eca0bb5abcacdf1b810..5a789fbb8f41192ef03151347db49143e59ccaee 100644 (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; }
index 1bd123e220ec0f91a6d13a1cf50344d8e7a67466..bfeb41a942996ce7829e051ab06296b86f159797 100644 (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);