clang API Documentation

Action.cpp
Go to the documentation of this file.
00001 //===--- Action.cpp - Abstract compilation steps --------------------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #include "clang/Driver/Action.h"
00011 #include "llvm/Support/ErrorHandling.h"
00012 #include <cassert>
00013 using namespace clang::driver;
00014 using namespace llvm::opt;
00015 
00016 Action::~Action() {
00017   if (OwnsInputs) {
00018     for (iterator it = begin(), ie = end(); it != ie; ++it)
00019       delete *it;
00020   }
00021 }
00022 
00023 const char *Action::getClassName(ActionClass AC) {
00024   switch (AC) {
00025   case InputClass: return "input";
00026   case BindArchClass: return "bind-arch";
00027   case PreprocessJobClass: return "preprocessor";
00028   case PrecompileJobClass: return "precompiler";
00029   case AnalyzeJobClass: return "analyzer";
00030   case MigrateJobClass: return "migrator";
00031   case CompileJobClass: return "compiler";
00032   case AssembleJobClass: return "assembler";
00033   case LinkJobClass: return "linker";
00034   case LipoJobClass: return "lipo";
00035   case DsymutilJobClass: return "dsymutil";
00036   case VerifyDebugInfoJobClass: return "verify-debug-info";
00037   case VerifyPCHJobClass: return "verify-pch";
00038   }
00039 
00040   llvm_unreachable("invalid class");
00041 }
00042 
00043 void InputAction::anchor() {}
00044 
00045 InputAction::InputAction(const Arg &_Input, types::ID _Type)
00046   : Action(InputClass, _Type), Input(_Input) {
00047 }
00048 
00049 void BindArchAction::anchor() {}
00050 
00051 BindArchAction::BindArchAction(std::unique_ptr<Action> Input,
00052                                const char *_ArchName)
00053     : Action(BindArchClass, std::move(Input)), ArchName(_ArchName) {}
00054 
00055 void JobAction::anchor() {}
00056 
00057 JobAction::JobAction(ActionClass Kind, std::unique_ptr<Action> Input,
00058                      types::ID Type)
00059     : Action(Kind, std::move(Input), Type) {}
00060 
00061 JobAction::JobAction(ActionClass Kind, const ActionList &Inputs, types::ID Type)
00062   : Action(Kind, Inputs, Type) {
00063 }
00064 
00065 void PreprocessJobAction::anchor() {}
00066 
00067 PreprocessJobAction::PreprocessJobAction(std::unique_ptr<Action> Input,
00068                                          types::ID OutputType)
00069     : JobAction(PreprocessJobClass, std::move(Input), OutputType) {}
00070 
00071 void PrecompileJobAction::anchor() {}
00072 
00073 PrecompileJobAction::PrecompileJobAction(std::unique_ptr<Action> Input,
00074                                          types::ID OutputType)
00075     : JobAction(PrecompileJobClass, std::move(Input), OutputType) {}
00076 
00077 void AnalyzeJobAction::anchor() {}
00078 
00079 AnalyzeJobAction::AnalyzeJobAction(std::unique_ptr<Action> Input,
00080                                    types::ID OutputType)
00081     : JobAction(AnalyzeJobClass, std::move(Input), OutputType) {}
00082 
00083 void MigrateJobAction::anchor() {}
00084 
00085 MigrateJobAction::MigrateJobAction(std::unique_ptr<Action> Input,
00086                                    types::ID OutputType)
00087     : JobAction(MigrateJobClass, std::move(Input), OutputType) {}
00088 
00089 void CompileJobAction::anchor() {}
00090 
00091 CompileJobAction::CompileJobAction(std::unique_ptr<Action> Input,
00092                                    types::ID OutputType)
00093     : JobAction(CompileJobClass, std::move(Input), OutputType) {}
00094 
00095 void AssembleJobAction::anchor() {}
00096 
00097 AssembleJobAction::AssembleJobAction(std::unique_ptr<Action> Input,
00098                                      types::ID OutputType)
00099     : JobAction(AssembleJobClass, std::move(Input), OutputType) {}
00100 
00101 void LinkJobAction::anchor() {}
00102 
00103 LinkJobAction::LinkJobAction(ActionList &Inputs, types::ID Type)
00104   : JobAction(LinkJobClass, Inputs, Type) {
00105 }
00106 
00107 void LipoJobAction::anchor() {}
00108 
00109 LipoJobAction::LipoJobAction(ActionList &Inputs, types::ID Type)
00110   : JobAction(LipoJobClass, Inputs, Type) {
00111 }
00112 
00113 void DsymutilJobAction::anchor() {}
00114 
00115 DsymutilJobAction::DsymutilJobAction(ActionList &Inputs, types::ID Type)
00116   : JobAction(DsymutilJobClass, Inputs, Type) {
00117 }
00118 
00119 void VerifyJobAction::anchor() {}
00120 
00121 VerifyJobAction::VerifyJobAction(ActionClass Kind,
00122                                  std::unique_ptr<Action> Input, types::ID Type)
00123     : JobAction(Kind, std::move(Input), Type) {
00124   assert((Kind == VerifyDebugInfoJobClass || Kind == VerifyPCHJobClass) &&
00125          "ActionClass is not a valid VerifyJobAction");
00126 }
00127 
00128 VerifyJobAction::VerifyJobAction(ActionClass Kind, ActionList &Inputs,
00129                                  types::ID Type)
00130     : JobAction(Kind, Inputs, Type) {
00131   assert((Kind == VerifyDebugInfoJobClass || Kind == VerifyPCHJobClass) &&
00132            "ActionClass is not a valid VerifyJobAction");
00133 }
00134 
00135 void VerifyDebugInfoJobAction::anchor() {}
00136 
00137 VerifyDebugInfoJobAction::VerifyDebugInfoJobAction(
00138     std::unique_ptr<Action> Input, types::ID Type)
00139     : VerifyJobAction(VerifyDebugInfoJobClass, std::move(Input), Type) {}
00140 
00141 void VerifyPCHJobAction::anchor() {}
00142 
00143 VerifyPCHJobAction::VerifyPCHJobAction(std::unique_ptr<Action> Input,
00144                                        types::ID Type)
00145     : VerifyJobAction(VerifyPCHJobClass, std::move(Input), Type) {}