blob: bfeb41a942996ce7829e051ab06296b86f159797 [file] [log] [blame]
Daniel Dunbar789e2202009-03-13 23:36:33 +00001//===--- Job.cpp - Command to Execute -----------------------------------*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "clang/Driver/Job.h"
11
12#include <cassert>
13using namespace clang::driver;
14
15Job::~Job() {}
16
Daniel Dunbardaab7b12009-12-02 03:23:25 +000017Command::Command(const Action &_Source, const Tool &_Creator,
18 const char *_Executable, const ArgStringList &_Arguments)
19 : Job(CommandClass), Source(_Source), Creator(_Creator),
20 Executable(_Executable), Arguments(_Arguments)
21{
Daniel Dunbar789e2202009-03-13 23:36:33 +000022}
23
24PipedJob::PipedJob() : Job(PipedJobClass) {}
25
Daniel Dunbar9d440232010-03-11 18:04:49 +000026PipedJob::~PipedJob() {
27 for (iterator it = begin(), ie = end(); it != ie; ++it)
28 delete *it;
29}
30
Daniel Dunbar789e2202009-03-13 23:36:33 +000031JobList::JobList() : Job(JobListClass) {}
Daniel Dunbar871adcf2009-03-18 07:06:02 +000032
Daniel Dunbar9d440232010-03-11 18:04:49 +000033JobList::~JobList() {
34 for (iterator it = begin(), ie = end(); it != ie; ++it)
35 delete *it;
36}
37
Daniel Dunbar871adcf2009-03-18 07:06:02 +000038void Job::addCommand(Command *C) {
39 if (PipedJob *PJ = dyn_cast<PipedJob>(this))
40 PJ->addCommand(C);
41 else
42 cast<JobList>(this)->addJob(C);
43}
Mike Stump1eb44332009-09-09 15:08:12 +000044