[cfe-commits] r81367 - in /cfe/trunk/lib/Driver: Tools.cpp Tools.h
Daniel Dunbar
daniel at zuster.org
Wed Sep 9 11:36:20 PDT 2009
Author: ddunbar
Date: Wed Sep 9 13:36:20 2009
New Revision: 81367
URL: http://llvm.org/viewvc/llvm-project?rev=81367&view=rev
Log:
Add DarwinTool base class for all Darwin tools, and move AddDarwin[Sub]Arch there.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=81367&r1=81366&r2=81367&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Sep 9 13:36:20 2009
@@ -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);
Modified: cfe/trunk/lib/Driver/Tools.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.h?rev=81367&r1=81366&r2=81367&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.h (original)
+++ cfe/trunk/lib/Driver/Tools.h Wed Sep 9 13:36:20 2009
@@ -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; }
More information about the cfe-commits
mailing list