Add DarwinTool base class for all Darwin tools, and move AddDarwin[Sub]Arch there.

llvm-svn: 81367
This commit is contained in:
Daniel Dunbar 2009-09-09 18:36:20 +00:00
parent e7af341454
commit e9ded43d1d
2 changed files with 25 additions and 20 deletions

View File

@ -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);

View File

@ -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; }