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