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"; |
Ted Kremenek | 30660a8 | 2012-03-06 20:06:33 +0000 | [diff] [blame] | 30 | case MigrateJobClass: return "migrator"; |
Daniel Dunbar | 2093335 | 2009-03-13 17:52:07 +0000 | [diff] [blame] | 31 | case CompileJobClass: return "compiler"; |
| 32 | case AssembleJobClass: return "assembler"; |
| 33 | case LinkJobClass: return "linker"; |
Daniel Dunbar | 85da007 | 2009-03-13 12:17:08 +0000 | [diff] [blame] | 34 | case LipoJobClass: return "lipo"; |
Daniel Dunbar | 6e0f254 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 35 | case DsymutilJobClass: return "dsymutil"; |
Eric Christopher | f857186 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 36 | case VerifyJobClass: return "verify"; |
Daniel Dunbar | 85da007 | 2009-03-13 12:17:08 +0000 | [diff] [blame] | 37 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 38 | |
David Blaikie | b219cfc | 2011-09-23 05:06:16 +0000 | [diff] [blame] | 39 | llvm_unreachable("invalid class"); |
Daniel Dunbar | 85da007 | 2009-03-13 12:17:08 +0000 | [diff] [blame] | 40 | } |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 41 | |
David Blaikie | 99ba9e3 | 2011-12-20 02:48:34 +0000 | [diff] [blame] | 42 | void InputAction::anchor() {} |
| 43 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 44 | InputAction::InputAction(const Arg &_Input, types::ID _Type) |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 45 | : Action(InputClass, _Type), Input(_Input) { |
| 46 | } |
| 47 | |
David Blaikie | 99ba9e3 | 2011-12-20 02:48:34 +0000 | [diff] [blame] | 48 | void BindArchAction::anchor() {} |
| 49 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 50 | BindArchAction::BindArchAction(Action *Input, const char *_ArchName) |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 51 | : Action(BindArchClass, Input, Input->getType()), ArchName(_ArchName) { |
| 52 | } |
| 53 | |
David Blaikie | 99ba9e3 | 2011-12-20 02:48:34 +0000 | [diff] [blame] | 54 | void JobAction::anchor() {} |
| 55 | |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 56 | JobAction::JobAction(ActionClass Kind, Action *Input, types::ID Type) |
| 57 | : Action(Kind, Input, Type) { |
| 58 | } |
| 59 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 60 | JobAction::JobAction(ActionClass Kind, const ActionList &Inputs, types::ID Type) |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 61 | : Action(Kind, Inputs, Type) { |
| 62 | } |
| 63 | |
David Blaikie | 99ba9e3 | 2011-12-20 02:48:34 +0000 | [diff] [blame] | 64 | void PreprocessJobAction::anchor() {} |
| 65 | |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 66 | PreprocessJobAction::PreprocessJobAction(Action *Input, types::ID OutputType) |
| 67 | : JobAction(PreprocessJobClass, Input, OutputType) { |
| 68 | } |
| 69 | |
David Blaikie | 99ba9e3 | 2011-12-20 02:48:34 +0000 | [diff] [blame] | 70 | void PrecompileJobAction::anchor() {} |
| 71 | |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 72 | PrecompileJobAction::PrecompileJobAction(Action *Input, types::ID OutputType) |
| 73 | : JobAction(PrecompileJobClass, Input, OutputType) { |
| 74 | } |
| 75 | |
David Blaikie | 99ba9e3 | 2011-12-20 02:48:34 +0000 | [diff] [blame] | 76 | void AnalyzeJobAction::anchor() {} |
| 77 | |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 78 | AnalyzeJobAction::AnalyzeJobAction(Action *Input, types::ID OutputType) |
| 79 | : JobAction(AnalyzeJobClass, Input, OutputType) { |
| 80 | } |
| 81 | |
Ted Kremenek | 30660a8 | 2012-03-06 20:06:33 +0000 | [diff] [blame] | 82 | void MigrateJobAction::anchor() {} |
| 83 | |
| 84 | MigrateJobAction::MigrateJobAction(Action *Input, types::ID OutputType) |
| 85 | : JobAction(MigrateJobClass, Input, OutputType) { |
| 86 | } |
| 87 | |
David Blaikie | 99ba9e3 | 2011-12-20 02:48:34 +0000 | [diff] [blame] | 88 | void CompileJobAction::anchor() {} |
| 89 | |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 90 | CompileJobAction::CompileJobAction(Action *Input, types::ID OutputType) |
| 91 | : JobAction(CompileJobClass, Input, OutputType) { |
| 92 | } |
| 93 | |
David Blaikie | 99ba9e3 | 2011-12-20 02:48:34 +0000 | [diff] [blame] | 94 | void AssembleJobAction::anchor() {} |
| 95 | |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 96 | AssembleJobAction::AssembleJobAction(Action *Input, types::ID OutputType) |
| 97 | : JobAction(AssembleJobClass, Input, OutputType) { |
| 98 | } |
| 99 | |
David Blaikie | 99ba9e3 | 2011-12-20 02:48:34 +0000 | [diff] [blame] | 100 | void LinkJobAction::anchor() {} |
| 101 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 102 | LinkJobAction::LinkJobAction(ActionList &Inputs, types::ID Type) |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 103 | : JobAction(LinkJobClass, Inputs, Type) { |
| 104 | } |
| 105 | |
David Blaikie | 99ba9e3 | 2011-12-20 02:48:34 +0000 | [diff] [blame] | 106 | void LipoJobAction::anchor() {} |
| 107 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 108 | LipoJobAction::LipoJobAction(ActionList &Inputs, types::ID Type) |
Daniel Dunbar | f40ed17 | 2009-03-13 23:08:03 +0000 | [diff] [blame] | 109 | : JobAction(LipoJobClass, Inputs, Type) { |
| 110 | } |
Daniel Dunbar | 6e0f254 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 111 | |
David Blaikie | 99ba9e3 | 2011-12-20 02:48:34 +0000 | [diff] [blame] | 112 | void DsymutilJobAction::anchor() {} |
| 113 | |
Daniel Dunbar | 6e0f254 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 114 | DsymutilJobAction::DsymutilJobAction(ActionList &Inputs, types::ID Type) |
| 115 | : JobAction(DsymutilJobClass, Inputs, Type) { |
| 116 | } |
Eric Christopher | f857186 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 117 | |
David Blaikie | 99ba9e3 | 2011-12-20 02:48:34 +0000 | [diff] [blame] | 118 | void VerifyJobAction::anchor() {} |
| 119 | |
Eric Christopher | f857186 | 2011-08-23 17:56:55 +0000 | [diff] [blame] | 120 | VerifyJobAction::VerifyJobAction(ActionList &Inputs, types::ID Type) |
| 121 | : JobAction(VerifyJobClass, Inputs, Type) { |
| 122 | } |