• 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/ADT/StringSwitch.h"
12 #include "llvm/Support/ErrorHandling.h"
13 #include "llvm/Support/Regex.h"
14 #include <cassert>
15 using namespace clang::driver;
16 using namespace llvm::opt;
17 
~Action()18 Action::~Action() {}
19 
getClassName(ActionClass AC)20 const char *Action::getClassName(ActionClass AC) {
21   switch (AC) {
22   case InputClass: return "input";
23   case BindArchClass: return "bind-arch";
24   case CudaDeviceClass: return "cuda-device";
25   case CudaHostClass: return "cuda-host";
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 BackendJobClass: return "backend";
32   case AssembleJobClass: return "assembler";
33   case LinkJobClass: return "linker";
34   case LipoJobClass: return "lipo";
35   case DsymutilJobClass: return "dsymutil";
36   case VerifyDebugInfoJobClass: return "verify-debug-info";
37   case VerifyPCHJobClass: return "verify-pch";
38   }
39 
40   llvm_unreachable("invalid class");
41 }
42 
anchor()43 void InputAction::anchor() {}
44 
InputAction(const Arg & _Input,types::ID _Type)45 InputAction::InputAction(const Arg &_Input, types::ID _Type)
46   : Action(InputClass, _Type), Input(_Input) {
47 }
48 
anchor()49 void BindArchAction::anchor() {}
50 
BindArchAction(Action * Input,const char * _ArchName)51 BindArchAction::BindArchAction(Action *Input, const char *_ArchName)
52     : Action(BindArchClass, Input), ArchName(_ArchName) {}
53 
anchor()54 void CudaDeviceAction::anchor() {}
55 
CudaDeviceAction(Action * Input,clang::CudaArch Arch,bool AtTopLevel)56 CudaDeviceAction::CudaDeviceAction(Action *Input, clang::CudaArch Arch,
57                                    bool AtTopLevel)
58     : Action(CudaDeviceClass, Input), GpuArch(Arch), AtTopLevel(AtTopLevel) {}
59 
anchor()60 void CudaHostAction::anchor() {}
61 
CudaHostAction(Action * Input,const ActionList & DeviceActions)62 CudaHostAction::CudaHostAction(Action *Input, const ActionList &DeviceActions)
63     : Action(CudaHostClass, Input), DeviceActions(DeviceActions) {}
64 
anchor()65 void JobAction::anchor() {}
66 
JobAction(ActionClass Kind,Action * Input,types::ID Type)67 JobAction::JobAction(ActionClass Kind, Action *Input, types::ID Type)
68     : Action(Kind, Input, Type) {}
69 
JobAction(ActionClass Kind,const ActionList & Inputs,types::ID Type)70 JobAction::JobAction(ActionClass Kind, const ActionList &Inputs, types::ID Type)
71   : Action(Kind, Inputs, Type) {
72 }
73 
anchor()74 void PreprocessJobAction::anchor() {}
75 
PreprocessJobAction(Action * Input,types::ID OutputType)76 PreprocessJobAction::PreprocessJobAction(Action *Input, types::ID OutputType)
77     : JobAction(PreprocessJobClass, Input, OutputType) {}
78 
anchor()79 void PrecompileJobAction::anchor() {}
80 
PrecompileJobAction(Action * Input,types::ID OutputType)81 PrecompileJobAction::PrecompileJobAction(Action *Input, types::ID OutputType)
82     : JobAction(PrecompileJobClass, Input, OutputType) {}
83 
anchor()84 void AnalyzeJobAction::anchor() {}
85 
AnalyzeJobAction(Action * Input,types::ID OutputType)86 AnalyzeJobAction::AnalyzeJobAction(Action *Input, types::ID OutputType)
87     : JobAction(AnalyzeJobClass, Input, OutputType) {}
88 
anchor()89 void MigrateJobAction::anchor() {}
90 
MigrateJobAction(Action * Input,types::ID OutputType)91 MigrateJobAction::MigrateJobAction(Action *Input, types::ID OutputType)
92     : JobAction(MigrateJobClass, Input, OutputType) {}
93 
anchor()94 void CompileJobAction::anchor() {}
95 
CompileJobAction(Action * Input,types::ID OutputType)96 CompileJobAction::CompileJobAction(Action *Input, types::ID OutputType)
97     : JobAction(CompileJobClass, Input, OutputType) {}
98 
anchor()99 void BackendJobAction::anchor() {}
100 
BackendJobAction(Action * Input,types::ID OutputType)101 BackendJobAction::BackendJobAction(Action *Input, types::ID OutputType)
102     : JobAction(BackendJobClass, Input, OutputType) {}
103 
anchor()104 void AssembleJobAction::anchor() {}
105 
AssembleJobAction(Action * Input,types::ID OutputType)106 AssembleJobAction::AssembleJobAction(Action *Input, types::ID OutputType)
107     : JobAction(AssembleJobClass, Input, OutputType) {}
108 
anchor()109 void LinkJobAction::anchor() {}
110 
LinkJobAction(ActionList & Inputs,types::ID Type)111 LinkJobAction::LinkJobAction(ActionList &Inputs, types::ID Type)
112   : JobAction(LinkJobClass, Inputs, Type) {
113 }
114 
anchor()115 void LipoJobAction::anchor() {}
116 
LipoJobAction(ActionList & Inputs,types::ID Type)117 LipoJobAction::LipoJobAction(ActionList &Inputs, types::ID Type)
118   : JobAction(LipoJobClass, Inputs, Type) {
119 }
120 
anchor()121 void DsymutilJobAction::anchor() {}
122 
DsymutilJobAction(ActionList & Inputs,types::ID Type)123 DsymutilJobAction::DsymutilJobAction(ActionList &Inputs, types::ID Type)
124   : JobAction(DsymutilJobClass, Inputs, Type) {
125 }
126 
anchor()127 void VerifyJobAction::anchor() {}
128 
VerifyJobAction(ActionClass Kind,Action * Input,types::ID Type)129 VerifyJobAction::VerifyJobAction(ActionClass Kind, Action *Input,
130                                  types::ID Type)
131     : JobAction(Kind, Input, Type) {
132   assert((Kind == VerifyDebugInfoJobClass || Kind == VerifyPCHJobClass) &&
133          "ActionClass is not a valid VerifyJobAction");
134 }
135 
anchor()136 void VerifyDebugInfoJobAction::anchor() {}
137 
VerifyDebugInfoJobAction(Action * Input,types::ID Type)138 VerifyDebugInfoJobAction::VerifyDebugInfoJobAction(Action *Input,
139                                                    types::ID Type)
140     : VerifyJobAction(VerifyDebugInfoJobClass, Input, Type) {}
141 
anchor()142 void VerifyPCHJobAction::anchor() {}
143 
VerifyPCHJobAction(Action * Input,types::ID Type)144 VerifyPCHJobAction::VerifyPCHJobAction(Action *Input, types::ID Type)
145     : VerifyJobAction(VerifyPCHJobClass, Input, Type) {}
146