summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp
diff options
context:
space:
mode:
authortheraven <theraven@FreeBSD.org>2013-09-06 20:08:03 +0000
committertheraven <theraven@FreeBSD.org>2013-09-06 20:08:03 +0000
commit1df952388b48e11694d9be00cbdb7fed2ca1c0f3 (patch)
tree323fdbecd93a672260c605a70c974da7b41353c6 /contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp
parent6965cdad6639b93d4b619f8e095c037377cd0d66 (diff)
downloadFreeBSD-src-1df952388b48e11694d9be00cbdb7fed2ca1c0f3.zip
FreeBSD-src-1df952388b48e11694d9be00cbdb7fed2ca1c0f3.tar.gz
On platforms where clang is the default compiler, don't build gcc or libstdc++.
To enable them, set WITH_GCC and WITH_GNUCXX in src.conf. Make clang default to using libc++ on FreeBSD 10. Bumped __FreeBSD_version for the change. GCC is still enabled on PC98, because the PC98 bootloader requires GCC to build (or, at least, hard-codes the use of gcc into its build). Thanks to everyone who helped make the ports tree ready for this (and bapt for coordinating them all). Also to imp for reviewing this and working on the forward-porting of the changes in our gcc so that we're getting to a much better place with regard to external toolchains. Sorry to all of the people who helped who I forgot to mention by name. Reviewed by: bapt, imp, dim, ...
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp')
-rw-r--r--contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp b/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp
index fffba0e..d8d580b 100644
--- a/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp
+++ b/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp
@@ -1851,6 +1851,38 @@ bool FreeBSD::UseSjLjExceptions() const {
}
}
+ToolChain::CXXStdlibType
+FreeBSD::GetCXXStdlibType(const ArgList &Args) const {
+ if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) {
+ StringRef Value = A->getValue();
+ if (Value == "libc++")
+ return ToolChain::CST_Libcxx;
+ if (Value == "libstdc++")
+ return ToolChain::CST_Libstdcxx;
+ getDriver().Diag(diag::err_drv_invalid_stdlib_name)
+ << A->getAsString(Args);
+ }
+
+ return getTriple().getOSMajorVersion() >= 10 ? ToolChain::CST_Libcxx :
+ ToolChain::CST_Libstdcxx;
+}
+
+void FreeBSD::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
+ ArgStringList &CC1Args) const {
+ if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
+ DriverArgs.hasArg(options::OPT_nostdincxx))
+ return;
+
+ if (GetCXXStdlibType(DriverArgs) == ToolChain::CST_Libcxx)
+ addSystemInclude(DriverArgs, CC1Args,
+ getDriver().SysRoot + "/usr/include/c++/v1");
+ else
+ addSystemInclude(DriverArgs, CC1Args,
+ getDriver().SysRoot + "/usr/include/c++/4.2");
+ return;
+
+}
+
/// NetBSD - NetBSD tool chain which can call as(1) and ld(1) directly.
NetBSD::NetBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)
OpenPOWER on IntegriCloud