Nick Lewycky | 3fdcc6f | 2010-12-31 17:31:54 +0000 | [diff] [blame] | 1 | //===--- Action.cpp - Abstract compilation steps --------------------------===// |
Daniel Dunbar | 2fe63e6 | 2009-03-12 18:40:18 +0000 | [diff] [blame] | 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 | 32c1a2a | 2010-03-11 18:04:58 +0000 | [diff] [blame] | 16 | if (OwnsInputs) { |
| 17 | for (iterator it = begin(), ie = end(); it != ie; ++it) |
| 18 | delete *it; |
| 19 | } |
Daniel Dunbar | 2154923 | 2009-03-18 02:55:38 +0000 | [diff] [blame] | 20 | } |
Daniel Dunbar | 85da007 | 2009-03-13 12:17:08 +0000 | [diff] [blame] | 21 | |
| 22 | const char *Action::getClassName(ActionClass AC) { |
| 23 | switch (AC) { |
| 24 | case InputClass: return "input"; |
| 25 | case BindArchClass: return "bind-arch"; |
Daniel Dunbar | 2093335 | 2009-03-13 17:52:07 +0000 | [diff] [blame] | 26 | case PreprocessJobClass: return "preprocessor"; |
| 27 | case PrecompileJobClass: return "precompiler"; |
| 28 | case AnalyzeJobClass: return "analyzer"; |
| 29 | case CompileJobClass: return "compiler"; |
| 30 | case AssembleJobClass: return "assembler"; |
| 31 | case LinkJobClass: return "linker"; |
Daniel Dunbar | 85da007 | 2009-03-13 12:17:08 +0000 | [diff] [blame] | 32 | case LipoJobClass: return "lipo"; |
Daniel Dunbar | 6e0f254 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 33 | case DsymutilJobClass: return "dsymutil"; |
Eric Christopher | f857186 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 34 | case VerifyJobClass: return "verify"; |
Daniel Dunbar | 85da007 | 2009-03-13 12:17:08 +0000 | [diff] [blame] | 35 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 36 | |
David Blaikie | b219cfc | 2011-09-23 05:06:16 +0000 | [diff] [blame] | 37 | llvm_unreachable("invalid class"); |
Daniel Dunbar | 85da007 | 2009-03-13 12:17:08 +0000 | [diff] [blame] | 38 | return 0; |
| 39 | } |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 40 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 41 | InputAction::InputAction(const Arg &_Input, types::ID _Type) |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 42 | : Action(InputClass, _Type), Input(_Input) { |
| 43 | } |
| 44 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 45 | BindArchAction::BindArchAction(Action *Input, const char *_ArchName) |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 46 | : Action(BindArchClass, Input, Input->getType()), ArchName(_ArchName) { |
| 47 | } |
| 48 | |
| 49 | JobAction::JobAction(ActionClass Kind, Action *Input, types::ID Type) |
| 50 | : Action(Kind, Input, Type) { |
| 51 | } |
| 52 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 53 | JobAction::JobAction(ActionClass Kind, const ActionList &Inputs, types::ID Type) |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 54 | : Action(Kind, Inputs, Type) { |
| 55 | } |
| 56 | |
| 57 | PreprocessJobAction::PreprocessJobAction(Action *Input, types::ID OutputType) |
| 58 | : JobAction(PreprocessJobClass, Input, OutputType) { |
| 59 | } |
| 60 | |
| 61 | PrecompileJobAction::PrecompileJobAction(Action *Input, types::ID OutputType) |
| 62 | : JobAction(PrecompileJobClass, Input, OutputType) { |
| 63 | } |
| 64 | |
| 65 | AnalyzeJobAction::AnalyzeJobAction(Action *Input, types::ID OutputType) |
| 66 | : JobAction(AnalyzeJobClass, Input, OutputType) { |
| 67 | } |
| 68 | |
| 69 | CompileJobAction::CompileJobAction(Action *Input, types::ID OutputType) |
| 70 | : JobAction(CompileJobClass, Input, OutputType) { |
| 71 | } |
| 72 | |
| 73 | AssembleJobAction::AssembleJobAction(Action *Input, types::ID OutputType) |
| 74 | : JobAction(AssembleJobClass, Input, OutputType) { |
| 75 | } |
| 76 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 77 | LinkJobAction::LinkJobAction(ActionList &Inputs, types::ID Type) |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 78 | : JobAction(LinkJobClass, Inputs, Type) { |
| 79 | } |
| 80 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 81 | LipoJobAction::LipoJobAction(ActionList &Inputs, types::ID Type) |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 82 | : JobAction(LipoJobClass, Inputs, Type) { |
| 83 | } |
Daniel Dunbar | 6e0f254 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 84 | |
| 85 | DsymutilJobAction::DsymutilJobAction(ActionList &Inputs, types::ID Type) |
| 86 | : JobAction(DsymutilJobClass, Inputs, Type) { |
| 87 | } |
Eric Christopher | f857186 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 88 | |
| 89 | VerifyJobAction::VerifyJobAction(ActionList &Inputs, types::ID Type) |
| 90 | : JobAction(VerifyJobClass, Inputs, Type) { |
| 91 | } |