Home | History | Annotate | Download | only in Driver
      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 
     12 #include <cassert>
     13 using namespace clang::driver;
     14 
     15 Action::~Action() {
     16   if (OwnsInputs) {
     17     for (iterator it = begin(), ie = end(); it != ie; ++it)
     18       delete *it;
     19   }
     20 }
     21 
     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 CompileJobClass: return "compiler";
     30   case AssembleJobClass: return "assembler";
     31   case LinkJobClass: return "linker";
     32   case LipoJobClass: return "lipo";
     33   case DsymutilJobClass: return "dsymutil";
     34   }
     35 
     36   assert(0 && "invalid class");
     37   return 0;
     38 }
     39 
     40 InputAction::InputAction(const Arg &_Input, types::ID _Type)
     41   : Action(InputClass, _Type), Input(_Input) {
     42 }
     43 
     44 BindArchAction::BindArchAction(Action *Input, const char *_ArchName)
     45   : Action(BindArchClass, Input, Input->getType()), ArchName(_ArchName) {
     46 }
     47 
     48 JobAction::JobAction(ActionClass Kind, Action *Input, types::ID Type)
     49   : Action(Kind, Input, Type) {
     50 }
     51 
     52 JobAction::JobAction(ActionClass Kind, const ActionList &Inputs, types::ID Type)
     53   : Action(Kind, Inputs, Type) {
     54 }
     55 
     56 PreprocessJobAction::PreprocessJobAction(Action *Input, types::ID OutputType)
     57   : JobAction(PreprocessJobClass, Input, OutputType) {
     58 }
     59 
     60 PrecompileJobAction::PrecompileJobAction(Action *Input, types::ID OutputType)
     61   : JobAction(PrecompileJobClass, Input, OutputType) {
     62 }
     63 
     64 AnalyzeJobAction::AnalyzeJobAction(Action *Input, types::ID OutputType)
     65   : JobAction(AnalyzeJobClass, Input, OutputType) {
     66 }
     67 
     68 CompileJobAction::CompileJobAction(Action *Input, types::ID OutputType)
     69   : JobAction(CompileJobClass, Input, OutputType) {
     70 }
     71 
     72 AssembleJobAction::AssembleJobAction(Action *Input, types::ID OutputType)
     73   : JobAction(AssembleJobClass, Input, OutputType) {
     74 }
     75 
     76 LinkJobAction::LinkJobAction(ActionList &Inputs, types::ID Type)
     77   : JobAction(LinkJobClass, Inputs, Type) {
     78 }
     79 
     80 LipoJobAction::LipoJobAction(ActionList &Inputs, types::ID Type)
     81   : JobAction(LipoJobClass, Inputs, Type) {
     82 }
     83 
     84 DsymutilJobAction::DsymutilJobAction(ActionList &Inputs, types::ID Type)
     85   : JobAction(DsymutilJobClass, Inputs, Type) {
     86 }
     87