Add DarwinTool base class for all Darwin tools, and move AddDarwin[Sub]Arch there.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81367 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 7cd57b9..6979408 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1398,8 +1398,8 @@
return 0;
}
-void darwin::Link::AddDarwinArch(const ArgList &Args,
- ArgStringList &CmdArgs) const {
+void darwin::DarwinTool::AddDarwinArch(const ArgList &Args,
+ ArgStringList &CmdArgs) const {
// Derived from darwin_arch spec.
CmdArgs.push_back("-arch");
@@ -1433,8 +1433,8 @@
}
}
-void darwin::Link::AddDarwinSubArch(const ArgList &Args,
- ArgStringList &CmdArgs) const {
+void darwin::DarwinTool::AddDarwinSubArch(const ArgList &Args,
+ ArgStringList &CmdArgs) const {
// Derived from darwin_subarch spec, not sure what the distinction
// exists for but at least for this chain it is the same.
AddDarwinArch(Args, CmdArgs);
diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h
index c584b5e..a6d4e9c 100644
--- a/lib/Driver/Tools.h
+++ b/lib/Driver/Tools.h
@@ -124,7 +124,20 @@
} // end namespace gcc
namespace darwin {
- class VISIBILITY_HIDDEN CC1 : public Tool {
+ class VISIBILITY_HIDDEN DarwinTool : public Tool {
+ protected:
+ void AddDarwinArch(const ArgList &Args, ArgStringList &CmdArgs) const;
+ void AddDarwinSubArch(const ArgList &Args, ArgStringList &CmdArgs) const;
+
+ const toolchains::Darwin &getDarwinToolChain() const {
+ return reinterpret_cast<const toolchains::Darwin&>(getToolChain());
+ }
+
+ public:
+ DarwinTool(const char *Name, const ToolChain &TC) : Tool(Name, TC) {};
+ };
+
+ class VISIBILITY_HIDDEN CC1 : public DarwinTool {
public:
static const char *getBaseInputName(const ArgList &Args,
const InputInfoList &Input);
@@ -149,7 +162,7 @@
void AddCPPArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
public:
- CC1(const char *Name, const ToolChain &TC) : Tool(Name, TC) {}
+ CC1(const char *Name, const ToolChain &TC) : DarwinTool(Name, TC) {}
virtual bool acceptsPipedInput() const { return true; }
virtual bool canPipeOutput() const { return true; }
@@ -180,9 +193,9 @@
const char *LinkingOutput) const;
};
- class VISIBILITY_HIDDEN Assemble : public Tool {
+ class VISIBILITY_HIDDEN Assemble : public DarwinTool {
public:
- Assemble(const ToolChain &TC) : Tool("darwin::Assemble", TC) {}
+ Assemble(const ToolChain &TC) : DarwinTool("darwin::Assemble", TC) {}
virtual bool acceptsPipedInput() const { return true; }
virtual bool canPipeOutput() const { return false; }
@@ -196,19 +209,11 @@
const char *LinkingOutput) const;
};
- class VISIBILITY_HIDDEN Link : public Tool {
- void AddDarwinArch(const ArgList &Args, ArgStringList &CmdArgs) const;
- void AddDarwinSubArch(const ArgList &Args, ArgStringList &CmdArgs) const;
+ class VISIBILITY_HIDDEN Link : public DarwinTool {
void AddLinkArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
- const toolchains::Darwin &getDarwinToolChain() const {
- return reinterpret_cast<const toolchains::Darwin&>(getToolChain());
- }
-
public:
- Link(const ToolChain &TC)
- : Tool("darwin::Link", TC) {
- }
+ Link(const ToolChain &TC) : DarwinTool("darwin::Link", TC) {}
virtual bool acceptsPipedInput() const { return false; }
virtual bool canPipeOutput() const { return false; }
@@ -222,9 +227,9 @@
const char *LinkingOutput) const;
};
- class VISIBILITY_HIDDEN Lipo : public Tool {
+ class VISIBILITY_HIDDEN Lipo : public DarwinTool {
public:
- Lipo(const ToolChain &TC) : Tool("darwin::Lipo", TC) {}
+ Lipo(const ToolChain &TC) : DarwinTool("darwin::Lipo", TC) {}
virtual bool acceptsPipedInput() const { return false; }
virtual bool canPipeOutput() const { return false; }