2011-01-01 01:31:54 +08:00
|
|
|
//===--- Action.cpp - Abstract compilation steps --------------------------===//
|
2009-03-13 02:40:18 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "clang/Driver/Action.h"
|
2011-09-23 13:57:42 +08:00
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
2009-03-13 02:40:18 +08:00
|
|
|
|
|
|
|
#include <cassert>
|
|
|
|
using namespace clang::driver;
|
|
|
|
|
2009-03-18 10:55:38 +08:00
|
|
|
Action::~Action() {
|
2010-03-12 02:04:58 +08:00
|
|
|
if (OwnsInputs) {
|
|
|
|
for (iterator it = begin(), ie = end(); it != ie; ++it)
|
|
|
|
delete *it;
|
|
|
|
}
|
2009-03-18 10:55:38 +08:00
|
|
|
}
|
2009-03-13 20:17:08 +08:00
|
|
|
|
|
|
|
const char *Action::getClassName(ActionClass AC) {
|
|
|
|
switch (AC) {
|
|
|
|
case InputClass: return "input";
|
|
|
|
case BindArchClass: return "bind-arch";
|
2009-03-14 01:52:07 +08:00
|
|
|
case PreprocessJobClass: return "preprocessor";
|
|
|
|
case PrecompileJobClass: return "precompiler";
|
|
|
|
case AnalyzeJobClass: return "analyzer";
|
2012-03-07 04:06:33 +08:00
|
|
|
case MigrateJobClass: return "migrator";
|
2009-03-14 01:52:07 +08:00
|
|
|
case CompileJobClass: return "compiler";
|
|
|
|
case AssembleJobClass: return "assembler";
|
|
|
|
case LinkJobClass: return "linker";
|
2009-03-13 20:17:08 +08:00
|
|
|
case LipoJobClass: return "lipo";
|
2010-06-05 02:28:36 +08:00
|
|
|
case DsymutilJobClass: return "dsymutil";
|
2011-08-24 01:56:55 +08:00
|
|
|
case VerifyJobClass: return "verify";
|
2009-03-13 20:17:08 +08:00
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2011-09-23 13:06:16 +08:00
|
|
|
llvm_unreachable("invalid class");
|
2009-03-13 20:17:08 +08:00
|
|
|
}
|
2009-03-14 07:08:03 +08:00
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void InputAction::anchor() {}
|
|
|
|
|
2009-09-09 23:08:12 +08:00
|
|
|
InputAction::InputAction(const Arg &_Input, types::ID _Type)
|
2009-03-14 07:08:03 +08:00
|
|
|
: Action(InputClass, _Type), Input(_Input) {
|
|
|
|
}
|
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void BindArchAction::anchor() {}
|
|
|
|
|
2009-09-09 23:08:12 +08:00
|
|
|
BindArchAction::BindArchAction(Action *Input, const char *_ArchName)
|
2009-03-14 07:08:03 +08:00
|
|
|
: Action(BindArchClass, Input, Input->getType()), ArchName(_ArchName) {
|
|
|
|
}
|
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void JobAction::anchor() {}
|
|
|
|
|
2009-03-14 07:08:03 +08:00
|
|
|
JobAction::JobAction(ActionClass Kind, Action *Input, types::ID Type)
|
|
|
|
: Action(Kind, Input, Type) {
|
|
|
|
}
|
|
|
|
|
2009-09-09 23:08:12 +08:00
|
|
|
JobAction::JobAction(ActionClass Kind, const ActionList &Inputs, types::ID Type)
|
2009-03-14 07:08:03 +08:00
|
|
|
: Action(Kind, Inputs, Type) {
|
|
|
|
}
|
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void PreprocessJobAction::anchor() {}
|
|
|
|
|
2009-03-14 07:08:03 +08:00
|
|
|
PreprocessJobAction::PreprocessJobAction(Action *Input, types::ID OutputType)
|
|
|
|
: JobAction(PreprocessJobClass, Input, OutputType) {
|
|
|
|
}
|
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void PrecompileJobAction::anchor() {}
|
|
|
|
|
2009-03-14 07:08:03 +08:00
|
|
|
PrecompileJobAction::PrecompileJobAction(Action *Input, types::ID OutputType)
|
|
|
|
: JobAction(PrecompileJobClass, Input, OutputType) {
|
|
|
|
}
|
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void AnalyzeJobAction::anchor() {}
|
|
|
|
|
2009-03-14 07:08:03 +08:00
|
|
|
AnalyzeJobAction::AnalyzeJobAction(Action *Input, types::ID OutputType)
|
|
|
|
: JobAction(AnalyzeJobClass, Input, OutputType) {
|
|
|
|
}
|
|
|
|
|
2012-03-07 04:06:33 +08:00
|
|
|
void MigrateJobAction::anchor() {}
|
|
|
|
|
|
|
|
MigrateJobAction::MigrateJobAction(Action *Input, types::ID OutputType)
|
|
|
|
: JobAction(MigrateJobClass, Input, OutputType) {
|
|
|
|
}
|
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void CompileJobAction::anchor() {}
|
|
|
|
|
2009-03-14 07:08:03 +08:00
|
|
|
CompileJobAction::CompileJobAction(Action *Input, types::ID OutputType)
|
|
|
|
: JobAction(CompileJobClass, Input, OutputType) {
|
|
|
|
}
|
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void AssembleJobAction::anchor() {}
|
|
|
|
|
2009-03-14 07:08:03 +08:00
|
|
|
AssembleJobAction::AssembleJobAction(Action *Input, types::ID OutputType)
|
|
|
|
: JobAction(AssembleJobClass, Input, OutputType) {
|
|
|
|
}
|
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void LinkJobAction::anchor() {}
|
|
|
|
|
2009-09-09 23:08:12 +08:00
|
|
|
LinkJobAction::LinkJobAction(ActionList &Inputs, types::ID Type)
|
2009-03-14 07:08:03 +08:00
|
|
|
: JobAction(LinkJobClass, Inputs, Type) {
|
|
|
|
}
|
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void LipoJobAction::anchor() {}
|
|
|
|
|
2009-09-09 23:08:12 +08:00
|
|
|
LipoJobAction::LipoJobAction(ActionList &Inputs, types::ID Type)
|
2009-03-14 07:08:03 +08:00
|
|
|
: JobAction(LipoJobClass, Inputs, Type) {
|
|
|
|
}
|
2010-06-05 02:28:36 +08:00
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void DsymutilJobAction::anchor() {}
|
|
|
|
|
2010-06-05 02:28:36 +08:00
|
|
|
DsymutilJobAction::DsymutilJobAction(ActionList &Inputs, types::ID Type)
|
|
|
|
: JobAction(DsymutilJobClass, Inputs, Type) {
|
|
|
|
}
|
2011-08-24 01:56:55 +08:00
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void VerifyJobAction::anchor() {}
|
|
|
|
|
2011-08-24 01:56:55 +08:00
|
|
|
VerifyJobAction::VerifyJobAction(ActionList &Inputs, types::ID Type)
|
|
|
|
: JobAction(VerifyJobClass, Inputs, Type) {
|
|
|
|
}
|