Daniel Dunbar | 2fe63e6 | 2009-03-12 18:40:18 +0000 | [diff] [blame] | 1 | //===--- Action.cpp - Abstract compilation steps ------------------------*-===// |
| 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/Action.h" |
| 11 | |
| 12 | #include <cassert> |
| 13 | using namespace clang::driver; |
| 14 | |
Daniel Dunbar | 2154923 | 2009-03-18 02:55:38 +0000 | [diff] [blame] | 15 | Action::~Action() { |
Daniel Dunbar | e29cd6f | 2009-03-18 03:02:22 +0000 | [diff] [blame] | 16 | // FIXME: Free the inputs. The problem is that BindArchAction shares |
| 17 | // inputs; so we can't just walk the inputs. |
Daniel Dunbar | 2154923 | 2009-03-18 02:55:38 +0000 | [diff] [blame] | 18 | } |
Daniel Dunbar | 85da007 | 2009-03-13 12:17:08 +0000 | [diff] [blame] | 19 | |
| 20 | const char *Action::getClassName(ActionClass AC) { |
| 21 | switch (AC) { |
| 22 | case InputClass: return "input"; |
| 23 | case BindArchClass: return "bind-arch"; |
Daniel Dunbar | 2093335 | 2009-03-13 17:52:07 +0000 | [diff] [blame] | 24 | case PreprocessJobClass: return "preprocessor"; |
| 25 | case PrecompileJobClass: return "precompiler"; |
| 26 | case AnalyzeJobClass: return "analyzer"; |
| 27 | case CompileJobClass: return "compiler"; |
| 28 | case AssembleJobClass: return "assembler"; |
| 29 | case LinkJobClass: return "linker"; |
Daniel Dunbar | 85da007 | 2009-03-13 12:17:08 +0000 | [diff] [blame] | 30 | case LipoJobClass: return "lipo"; |
| 31 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 32 | |
Daniel Dunbar | 85da007 | 2009-03-13 12:17:08 +0000 | [diff] [blame] | 33 | assert(0 && "invalid class"); |
| 34 | return 0; |
| 35 | } |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 36 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 37 | InputAction::InputAction(const Arg &_Input, types::ID _Type) |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 38 | : Action(InputClass, _Type), Input(_Input) { |
| 39 | } |
| 40 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 41 | BindArchAction::BindArchAction(Action *Input, const char *_ArchName) |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 42 | : Action(BindArchClass, Input, Input->getType()), ArchName(_ArchName) { |
| 43 | } |
| 44 | |
| 45 | JobAction::JobAction(ActionClass Kind, Action *Input, types::ID Type) |
| 46 | : Action(Kind, Input, Type) { |
| 47 | } |
| 48 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 49 | JobAction::JobAction(ActionClass Kind, const ActionList &Inputs, types::ID Type) |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 50 | : Action(Kind, Inputs, Type) { |
| 51 | } |
| 52 | |
| 53 | PreprocessJobAction::PreprocessJobAction(Action *Input, types::ID OutputType) |
| 54 | : JobAction(PreprocessJobClass, Input, OutputType) { |
| 55 | } |
| 56 | |
| 57 | PrecompileJobAction::PrecompileJobAction(Action *Input, types::ID OutputType) |
| 58 | : JobAction(PrecompileJobClass, Input, OutputType) { |
| 59 | } |
| 60 | |
| 61 | AnalyzeJobAction::AnalyzeJobAction(Action *Input, types::ID OutputType) |
| 62 | : JobAction(AnalyzeJobClass, Input, OutputType) { |
| 63 | } |
| 64 | |
| 65 | CompileJobAction::CompileJobAction(Action *Input, types::ID OutputType) |
| 66 | : JobAction(CompileJobClass, Input, OutputType) { |
| 67 | } |
| 68 | |
| 69 | AssembleJobAction::AssembleJobAction(Action *Input, types::ID OutputType) |
| 70 | : JobAction(AssembleJobClass, Input, OutputType) { |
| 71 | } |
| 72 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 73 | LinkJobAction::LinkJobAction(ActionList &Inputs, types::ID Type) |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 74 | : JobAction(LinkJobClass, Inputs, Type) { |
| 75 | } |
| 76 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 77 | LipoJobAction::LipoJobAction(ActionList &Inputs, types::ID Type) |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 78 | : JobAction(LipoJobClass, Inputs, Type) { |
| 79 | } |