aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-11-06 23:39:37 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-11-06 23:39:37 +0000
commitb37fe61e661453800f826897706b1d75f98dd7c1 (patch)
treeccebf8110fbdcfd4aaeaeea149aa2e13d7ef75d9
parent19347edf7809866350750a1997ec4db009832fa4 (diff)
Begin lifting some of the one-off checking logic into generic helper
routines on the base toolchain class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143900 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Driver/ToolChains.cpp8
-rw-r--r--lib/Driver/ToolChains.h15
2 files changed, 18 insertions, 5 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 51f7b770be..fec2209ca8 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -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))
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
index 5da1bc4eb3..60453ebca4 100644
--- a/lib/Driver/ToolChains.h
+++ b/lib/Driver/ToolChains.h
@@ -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.