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;
|
2013-06-15 01:17:23 +08:00
|
|
|
using namespace llvm::opt;
|
2009-03-13 02:40:18 +08:00
|
|
|
|
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";
|
2014-02-07 02:53:25 +08:00
|
|
|
case VerifyDebugInfoJobClass: return "verify-debug-info";
|
|
|
|
case VerifyPCHJobClass: return "verify-pch";
|
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() {}
|
|
|
|
|
2014-08-29 15:25:23 +08:00
|
|
|
BindArchAction::BindArchAction(std::unique_ptr<Action> Input,
|
|
|
|
const char *_ArchName)
|
|
|
|
: Action(BindArchClass, std::move(Input)), ArchName(_ArchName) {}
|
2009-03-14 07:08:03 +08:00
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void JobAction::anchor() {}
|
|
|
|
|
2014-08-29 15:25:23 +08:00
|
|
|
JobAction::JobAction(ActionClass Kind, std::unique_ptr<Action> Input,
|
|
|
|
types::ID Type)
|
|
|
|
: Action(Kind, std::move(Input), Type) {}
|
2009-03-14 07:08:03 +08:00
|
|
|
|
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() {}
|
|
|
|
|
2014-08-29 15:25:23 +08:00
|
|
|
PreprocessJobAction::PreprocessJobAction(std::unique_ptr<Action> Input,
|
|
|
|
types::ID OutputType)
|
|
|
|
: JobAction(PreprocessJobClass, std::move(Input), OutputType) {}
|
2009-03-14 07:08:03 +08:00
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void PrecompileJobAction::anchor() {}
|
|
|
|
|
2014-08-29 15:25:23 +08:00
|
|
|
PrecompileJobAction::PrecompileJobAction(std::unique_ptr<Action> Input,
|
|
|
|
types::ID OutputType)
|
|
|
|
: JobAction(PrecompileJobClass, std::move(Input), OutputType) {}
|
2009-03-14 07:08:03 +08:00
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void AnalyzeJobAction::anchor() {}
|
|
|
|
|
2014-08-29 15:25:23 +08:00
|
|
|
AnalyzeJobAction::AnalyzeJobAction(std::unique_ptr<Action> Input,
|
|
|
|
types::ID OutputType)
|
|
|
|
: JobAction(AnalyzeJobClass, std::move(Input), OutputType) {}
|
2009-03-14 07:08:03 +08:00
|
|
|
|
2012-03-07 04:06:33 +08:00
|
|
|
void MigrateJobAction::anchor() {}
|
|
|
|
|
2014-08-29 15:25:23 +08:00
|
|
|
MigrateJobAction::MigrateJobAction(std::unique_ptr<Action> Input,
|
|
|
|
types::ID OutputType)
|
|
|
|
: JobAction(MigrateJobClass, std::move(Input), OutputType) {}
|
2012-03-07 04:06:33 +08:00
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void CompileJobAction::anchor() {}
|
|
|
|
|
2014-08-29 15:25:23 +08:00
|
|
|
CompileJobAction::CompileJobAction(std::unique_ptr<Action> Input,
|
|
|
|
types::ID OutputType)
|
|
|
|
: JobAction(CompileJobClass, std::move(Input), OutputType) {}
|
2009-03-14 07:08:03 +08:00
|
|
|
|
2011-12-20 10:48:34 +08:00
|
|
|
void AssembleJobAction::anchor() {}
|
|
|
|
|
2014-08-29 15:25:23 +08:00
|
|
|
AssembleJobAction::AssembleJobAction(std::unique_ptr<Action> Input,
|
|
|
|
types::ID OutputType)
|
|
|
|
: JobAction(AssembleJobClass, std::move(Input), OutputType) {}
|
2009-03-14 07:08:03 +08:00
|
|
|
|
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() {}
|
|
|
|
|
2014-08-29 15:25:23 +08:00
|
|
|
VerifyJobAction::VerifyJobAction(ActionClass Kind,
|
|
|
|
std::unique_ptr<Action> Input, types::ID Type)
|
|
|
|
: JobAction(Kind, std::move(Input), Type) {
|
2014-02-07 02:53:25 +08:00
|
|
|
assert((Kind == VerifyDebugInfoJobClass || Kind == VerifyPCHJobClass) &&
|
|
|
|
"ActionClass is not a valid VerifyJobAction");
|
|
|
|
}
|
|
|
|
|
|
|
|
VerifyJobAction::VerifyJobAction(ActionClass Kind, ActionList &Inputs,
|
|
|
|
types::ID Type)
|
|
|
|
: JobAction(Kind, Inputs, Type) {
|
|
|
|
assert((Kind == VerifyDebugInfoJobClass || Kind == VerifyPCHJobClass) &&
|
|
|
|
"ActionClass is not a valid VerifyJobAction");
|
|
|
|
}
|
|
|
|
|
|
|
|
void VerifyDebugInfoJobAction::anchor() {}
|
|
|
|
|
2014-08-29 15:25:23 +08:00
|
|
|
VerifyDebugInfoJobAction::VerifyDebugInfoJobAction(
|
|
|
|
std::unique_ptr<Action> Input, types::ID Type)
|
|
|
|
: VerifyJobAction(VerifyDebugInfoJobClass, std::move(Input), Type) {}
|
2014-02-07 02:53:25 +08:00
|
|
|
|
|
|
|
void VerifyPCHJobAction::anchor() {}
|
|
|
|
|
2014-08-29 15:25:23 +08:00
|
|
|
VerifyPCHJobAction::VerifyPCHJobAction(std::unique_ptr<Action> Input,
|
|
|
|
types::ID Type)
|
|
|
|
: VerifyJobAction(VerifyPCHJobClass, std::move(Input), Type) {}
|