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