Begin lifting some of the one-off checking logic into generic helper

routines on the base toolchain class.

llvm-svn: 143900
This commit is contained in:
Chandler Carruth 2011-11-06 23:39:37 +00:00
parent 4c90fba23e
commit efad16ad6b
2 changed files with 18 additions and 5 deletions

View File

@ -2011,9 +2011,6 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
return;
const llvm::Triple &TargetTriple = getTriple();
const llvm::Triple::ArchType TargetArch = TargetTriple.getArch();
bool IsTarget64Bit = (TargetArch == llvm::Triple::x86_64 ||
TargetArch == llvm::Triple::ppc64);
StringRef CxxIncludeRoot(CXX_INCLUDE_ROOT);
if (!CxxIncludeRoot.empty()) {
@ -2023,8 +2020,8 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
addLibStdCXXIncludePaths(
CxxIncludeRoot,
CxxIncludeArch + (IsTarget64Bit ? CXX_INCLUDE_64BIT_DIR
: CXX_INCLUDE_32BIT_DIR),
CxxIncludeArch + (isTarget64Bit() ? CXX_INCLUDE_64BIT_DIR
: CXX_INCLUDE_32BIT_DIR),
DriverArgs, CC1Args);
return;
}
@ -2034,6 +2031,7 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
// mismatches of just bit width.
llvm::Triple::ArchType HostArch =
llvm::Triple(getDriver().DefaultHostTriple).getArch();
llvm::Triple::ArchType TargetArch = TargetTriple.getArch();
StringRef Suffix;
if ((HostArch == llvm::Triple::x86 && TargetArch == llvm::Triple::x86_64) ||
(HostArch == llvm::Triple::ppc && TargetArch == llvm::Triple::ppc64))

View File

@ -118,6 +118,21 @@ public:
virtual bool IsUnwindTablesDefault() const;
virtual const char *GetDefaultRelocationModel() const;
virtual const char *GetForcedPicModel() const;
protected:
/// \name ToolChain Implementation Helper Functions
/// @{
/// \brief Check whether the target triple's architecture is 64-bits.
bool isTarget64Bit() const {
return (getTriple().getArch() == llvm::Triple::x86_64 ||
getTriple().getArch() == llvm::Triple::ppc64);
}
/// \brief Check whether the target triple's architecture is 32-bits.
/// FIXME: This should likely do more than just negate the 64-bit query.
bool isTarget32Bit() const { return !isTarget64Bit(); }
/// @}
};
/// Darwin - The base Darwin tool chain.