diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-09-09 18:36:20 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-09-09 18:36:20 +0000 |
commit | fbefe6bd6f62a3361813498dc672ab0d6c0d4fd1 (patch) | |
tree | 52aa2fd57f60442f3be38eb46caa883ce1f0c8f9 | |
parent | 0dcb9a3705743ec972af37f48ead81a0939e3958 (diff) |
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
-rw-r--r-- | lib/Driver/Tools.cpp | 8 | ||||
-rw-r--r-- | lib/Driver/Tools.h | 37 |
2 files changed, 25 insertions, 20 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 7cd57b92fc..697940829b 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1398,8 +1398,8 @@ static const char *GetArmArchForMCpu(llvm::StringRef Value) { 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::AddDarwinArch(const ArgList &Args, } } -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 c584b5ef05..a6d4e9c0ab 100644 --- a/lib/Driver/Tools.h +++ b/lib/Driver/Tools.h @@ -124,7 +124,20 @@ namespace gcc { } // 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 @@ namespace darwin { 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 @@ namespace darwin { 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 @@ namespace darwin { 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 @@ namespace darwin { 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; } |