Driver: Add an explicit dsymutil action.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105474 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Driver/Action.h b/include/clang/Driver/Action.h
index ab3162a..4b45c98 100644
--- a/include/clang/Driver/Action.h
+++ b/include/clang/Driver/Action.h
@@ -51,9 +51,10 @@
AssembleJobClass,
LinkJobClass,
LipoJobClass,
+ DsymutilJobClass,
JobClassFirst=PreprocessJobClass,
- JobClassLast=LipoJobClass
+ JobClassLast=DsymutilJobClass
};
static const char *getClassName(ActionClass AC);
@@ -211,6 +212,16 @@
static bool classof(const LipoJobAction *) { return true; }
};
+class DsymutilJobAction : public JobAction {
+public:
+ DsymutilJobAction(ActionList &Inputs, types::ID Type);
+
+ static bool classof(const Action *A) {
+ return A->getKind() == DsymutilJobClass;
+ }
+ static bool classof(const DsymutilJobAction *) { return true; }
+};
+
} // end namespace driver
} // end namespace clang
diff --git a/lib/Driver/Action.cpp b/lib/Driver/Action.cpp
index b9a3306..f34971b 100644
--- a/lib/Driver/Action.cpp
+++ b/lib/Driver/Action.cpp
@@ -30,6 +30,7 @@
case AssembleJobClass: return "assembler";
case LinkJobClass: return "linker";
case LipoJobClass: return "lipo";
+ case DsymutilJobClass: return "dsymutil";
}
assert(0 && "invalid class");
@@ -79,3 +80,7 @@
LipoJobAction::LipoJobAction(ActionList &Inputs, types::ID Type)
: JobAction(LipoJobClass, Inputs, Type) {
}
+
+DsymutilJobAction::DsymutilJobAction(ActionList &Inputs, types::ID Type)
+ : JobAction(DsymutilJobClass, Inputs, Type) {
+}
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index abb55b0..92c7d79 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -225,6 +225,8 @@
T = new tools::darwin::Link(*this); break;
case Action::LipoJobClass:
T = new tools::darwin::Lipo(*this); break;
+ case Action::DsymutilJobClass:
+ T = new tools::darwin::Dsymutil(*this); break;
}
}
@@ -740,6 +742,8 @@
// driver is Darwin.
case Action::LipoJobClass:
T = new tools::darwin::Lipo(*this); break;
+ case Action::DsymutilJobClass:
+ T = new tools::darwin::Dsymutil(*this); break;
}
}
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 0d6cb30..518debc 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -2603,6 +2603,26 @@
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
+void darwin::Dsymutil::ConstructJob(Compilation &C, const JobAction &JA,
+ Job &Dest, const InputInfo &Output,
+ const InputInfoList &Inputs,
+ const ArgList &Args,
+ const char *LinkingOutput) const {
+ ArgStringList CmdArgs;
+
+ assert(Inputs.size() == 1 && "Unable to handle multiple inputs.");
+ const InputInfo &Input = Inputs[0];
+ assert(Input.isFilename() && "Unexpected dsymutil input.");
+ CmdArgs.push_back(Input.getFilename());
+
+ CmdArgs.push_back("-o");
+ CmdArgs.push_back(Output.getFilename());
+
+ const char *Exec =
+ Args.MakeArgString(getToolChain().GetProgramPath(C, "dsymutil"));
+ Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+}
+
void auroraux::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
Job &Dest, const InputInfo &Output,
const InputInfoList &Inputs,
diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h
index d5e98dd..606007d 100644
--- a/lib/Driver/Tools.h
+++ b/lib/Driver/Tools.h
@@ -288,6 +288,23 @@
const ArgList &TCArgs,
const char *LinkingOutput) const;
};
+
+ class LLVM_LIBRARY_VISIBILITY Dsymutil : public DarwinTool {
+ public:
+ Dsymutil(const ToolChain &TC) : DarwinTool("darwin::Dsymutil",
+ "dsymutil", TC) {}
+
+ virtual bool acceptsPipedInput() const { return false; }
+ virtual bool canPipeOutput() const { return false; }
+ virtual bool hasIntegratedCPP() const { return false; }
+
+ virtual void ConstructJob(Compilation &C, const JobAction &JA,
+ Job &Dest,
+ const InputInfo &Output,
+ const InputInfoList &Inputs,
+ const ArgList &TCArgs,
+ const char *LinkingOutput) const;
+ };
}
/// openbsd -- Directly call GNU Binutils assembler and linker