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 #include "llvm/Support/ErrorHandling.h"
12 #include <cassert>
13 using namespace clang::driver;
14 using namespace llvm::opt;
15
~Action()16 Action::~Action() {
17 if (OwnsInputs) {
18 for (iterator it = begin(), ie = end(); it != ie; ++it)
19 delete *it;
20 }
21 }
22
getClassName(ActionClass AC)23 const char *Action::getClassName(ActionClass AC) {
24 switch (AC) {
25 case InputClass: return "input";
26 case BindArchClass: return "bind-arch";
27 case PreprocessJobClass: return "preprocessor";
28 case PrecompileJobClass: return "precompiler";
29 case AnalyzeJobClass: return "analyzer";
30 case MigrateJobClass: return "migrator";
31 case CompileJobClass: return "compiler";
32 case AssembleJobClass: return "assembler";
33 case LinkJobClass: return "linker";
34 case LipoJobClass: return "lipo";
35 case DsymutilJobClass: return "dsymutil";
36 case VerifyJobClass: return "verify";
37 }
38
39 llvm_unreachable("invalid class");
40 }
41
anchor()42 void InputAction::anchor() {}
43
InputAction(const Arg & _Input,types::ID _Type)44 InputAction::InputAction(const Arg &_Input, types::ID _Type)
45 : Action(InputClass, _Type), Input(_Input) {
46 }
47
anchor()48 void BindArchAction::anchor() {}
49
BindArchAction(Action * Input,const char * _ArchName)50 BindArchAction::BindArchAction(Action *Input, const char *_ArchName)
51 : Action(BindArchClass, Input, Input->getType()), ArchName(_ArchName) {
52 }
53
anchor()54 void JobAction::anchor() {}
55
JobAction(ActionClass Kind,Action * Input,types::ID Type)56 JobAction::JobAction(ActionClass Kind, Action *Input, types::ID Type)
57 : Action(Kind, Input, Type) {
58 }
59
JobAction(ActionClass Kind,const ActionList & Inputs,types::ID Type)60 JobAction::JobAction(ActionClass Kind, const ActionList &Inputs, types::ID Type)
61 : Action(Kind, Inputs, Type) {
62 }
63
anchor()64 void PreprocessJobAction::anchor() {}
65
PreprocessJobAction(Action * Input,types::ID OutputType)66 PreprocessJobAction::PreprocessJobAction(Action *Input, types::ID OutputType)
67 : JobAction(PreprocessJobClass, Input, OutputType) {
68 }
69
anchor()70 void PrecompileJobAction::anchor() {}
71
PrecompileJobAction(Action * Input,types::ID OutputType)72 PrecompileJobAction::PrecompileJobAction(Action *Input, types::ID OutputType)
73 : JobAction(PrecompileJobClass, Input, OutputType) {
74 }
75
anchor()76 void AnalyzeJobAction::anchor() {}
77
AnalyzeJobAction(Action * Input,types::ID OutputType)78 AnalyzeJobAction::AnalyzeJobAction(Action *Input, types::ID OutputType)
79 : JobAction(AnalyzeJobClass, Input, OutputType) {
80 }
81
anchor()82 void MigrateJobAction::anchor() {}
83
MigrateJobAction(Action * Input,types::ID OutputType)84 MigrateJobAction::MigrateJobAction(Action *Input, types::ID OutputType)
85 : JobAction(MigrateJobClass, Input, OutputType) {
86 }
87
anchor()88 void CompileJobAction::anchor() {}
89
CompileJobAction(Action * Input,types::ID OutputType)90 CompileJobAction::CompileJobAction(Action *Input, types::ID OutputType)
91 : JobAction(CompileJobClass, Input, OutputType) {
92 }
93
anchor()94 void AssembleJobAction::anchor() {}
95
AssembleJobAction(Action * Input,types::ID OutputType)96 AssembleJobAction::AssembleJobAction(Action *Input, types::ID OutputType)
97 : JobAction(AssembleJobClass, Input, OutputType) {
98 }
99
anchor()100 void LinkJobAction::anchor() {}
101
LinkJobAction(ActionList & Inputs,types::ID Type)102 LinkJobAction::LinkJobAction(ActionList &Inputs, types::ID Type)
103 : JobAction(LinkJobClass, Inputs, Type) {
104 }
105
anchor()106 void LipoJobAction::anchor() {}
107
LipoJobAction(ActionList & Inputs,types::ID Type)108 LipoJobAction::LipoJobAction(ActionList &Inputs, types::ID Type)
109 : JobAction(LipoJobClass, Inputs, Type) {
110 }
111
anchor()112 void DsymutilJobAction::anchor() {}
113
DsymutilJobAction(ActionList & Inputs,types::ID Type)114 DsymutilJobAction::DsymutilJobAction(ActionList &Inputs, types::ID Type)
115 : JobAction(DsymutilJobClass, Inputs, Type) {
116 }
117
anchor()118 void VerifyJobAction::anchor() {}
119
VerifyJobAction(ActionList & Inputs,types::ID Type)120 VerifyJobAction::VerifyJobAction(ActionList &Inputs, types::ID Type)
121 : JobAction(VerifyJobClass, Inputs, Type) {
122 }
123