summaryrefslogtreecommitdiffstats
path: root/lib/Driver/Action.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-08-29 07:25:23 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-08-29 07:25:23 +0000
commitf11dfe02ad387ab7421599c1a008a36977866bcc (patch)
treeec166d709b41487e214d5fc1a769472ad9de8497 /lib/Driver/Action.cpp
parenta0a1a1e037d04ed13777407c69b4a7dfe838655e (diff)
unique_ptrify Driver Action handling
It hits a limit when we reach ActionList, which is used for dynamic conditional ownership, so we lose type safety there. This did expose at least one caller "lying" about ownership (passing ownership to an Action, then updating the Action to specify that it doesn't actually own the thing that was passed) - changing this to unique_ptr just makes that oddity more obvious. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216713 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Action.cpp')
-rw-r--r--lib/Driver/Action.cpp67
1 files changed, 33 insertions, 34 deletions
diff --git a/lib/Driver/Action.cpp b/lib/Driver/Action.cpp
index 86a48fd8b7..d4f339d376 100644
--- a/lib/Driver/Action.cpp
+++ b/lib/Driver/Action.cpp
@@ -48,15 +48,15 @@ InputAction::InputAction(const Arg &_Input, types::ID _Type)
void BindArchAction::anchor() {}
-BindArchAction::BindArchAction(Action *Input, const char *_ArchName)
- : Action(BindArchClass, Input, Input->getType()), ArchName(_ArchName) {
-}
+BindArchAction::BindArchAction(std::unique_ptr<Action> Input,
+ const char *_ArchName)
+ : Action(BindArchClass, std::move(Input)), ArchName(_ArchName) {}
void JobAction::anchor() {}
-JobAction::JobAction(ActionClass Kind, Action *Input, types::ID Type)
- : Action(Kind, Input, Type) {
-}
+JobAction::JobAction(ActionClass Kind, std::unique_ptr<Action> Input,
+ types::ID Type)
+ : Action(Kind, std::move(Input), Type) {}
JobAction::JobAction(ActionClass Kind, const ActionList &Inputs, types::ID Type)
: Action(Kind, Inputs, Type) {
@@ -64,39 +64,39 @@ JobAction::JobAction(ActionClass Kind, const ActionList &Inputs, types::ID Type)
void PreprocessJobAction::anchor() {}
-PreprocessJobAction::PreprocessJobAction(Action *Input, types::ID OutputType)
- : JobAction(PreprocessJobClass, Input, OutputType) {
-}
+PreprocessJobAction::PreprocessJobAction(std::unique_ptr<Action> Input,
+ types::ID OutputType)
+ : JobAction(PreprocessJobClass, std::move(Input), OutputType) {}
void PrecompileJobAction::anchor() {}
-PrecompileJobAction::PrecompileJobAction(Action *Input, types::ID OutputType)
- : JobAction(PrecompileJobClass, Input, OutputType) {
-}
+PrecompileJobAction::PrecompileJobAction(std::unique_ptr<Action> Input,
+ types::ID OutputType)
+ : JobAction(PrecompileJobClass, std::move(Input), OutputType) {}
void AnalyzeJobAction::anchor() {}
-AnalyzeJobAction::AnalyzeJobAction(Action *Input, types::ID OutputType)
- : JobAction(AnalyzeJobClass, Input, OutputType) {
-}
+AnalyzeJobAction::AnalyzeJobAction(std::unique_ptr<Action> Input,
+ types::ID OutputType)
+ : JobAction(AnalyzeJobClass, std::move(Input), OutputType) {}
void MigrateJobAction::anchor() {}
-MigrateJobAction::MigrateJobAction(Action *Input, types::ID OutputType)
- : JobAction(MigrateJobClass, Input, OutputType) {
-}
+MigrateJobAction::MigrateJobAction(std::unique_ptr<Action> Input,
+ types::ID OutputType)
+ : JobAction(MigrateJobClass, std::move(Input), OutputType) {}
void CompileJobAction::anchor() {}
-CompileJobAction::CompileJobAction(Action *Input, types::ID OutputType)
- : JobAction(CompileJobClass, Input, OutputType) {
-}
+CompileJobAction::CompileJobAction(std::unique_ptr<Action> Input,
+ types::ID OutputType)
+ : JobAction(CompileJobClass, std::move(Input), OutputType) {}
void AssembleJobAction::anchor() {}
-AssembleJobAction::AssembleJobAction(Action *Input, types::ID OutputType)
- : JobAction(AssembleJobClass, Input, OutputType) {
-}
+AssembleJobAction::AssembleJobAction(std::unique_ptr<Action> Input,
+ types::ID OutputType)
+ : JobAction(AssembleJobClass, std::move(Input), OutputType) {}
void LinkJobAction::anchor() {}
@@ -118,9 +118,9 @@ DsymutilJobAction::DsymutilJobAction(ActionList &Inputs, types::ID Type)
void VerifyJobAction::anchor() {}
-VerifyJobAction::VerifyJobAction(ActionClass Kind, Action *Input,
- types::ID Type)
- : JobAction(Kind, Input, Type) {
+VerifyJobAction::VerifyJobAction(ActionClass Kind,
+ std::unique_ptr<Action> Input, types::ID Type)
+ : JobAction(Kind, std::move(Input), Type) {
assert((Kind == VerifyDebugInfoJobClass || Kind == VerifyPCHJobClass) &&
"ActionClass is not a valid VerifyJobAction");
}
@@ -134,13 +134,12 @@ VerifyJobAction::VerifyJobAction(ActionClass Kind, ActionList &Inputs,
void VerifyDebugInfoJobAction::anchor() {}
-VerifyDebugInfoJobAction::VerifyDebugInfoJobAction(Action *Input,
- types::ID Type)
- : VerifyJobAction(VerifyDebugInfoJobClass, Input, Type) {
-}
+VerifyDebugInfoJobAction::VerifyDebugInfoJobAction(
+ std::unique_ptr<Action> Input, types::ID Type)
+ : VerifyJobAction(VerifyDebugInfoJobClass, std::move(Input), Type) {}
void VerifyPCHJobAction::anchor() {}
-VerifyPCHJobAction::VerifyPCHJobAction(Action *Input, types::ID Type)
- : VerifyJobAction(VerifyPCHJobClass, Input, Type) {
-}
+VerifyPCHJobAction::VerifyPCHJobAction(std::unique_ptr<Action> Input,
+ types::ID Type)
+ : VerifyJobAction(VerifyPCHJobClass, std::move(Input), Type) {}