[PATCH] D15920: [CMake] Add option to switch default C++ stdlib
Jonas Hahnfeld via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 10 04:15:11 PST 2016
Hahnfeld marked an inline comment as done.
Hahnfeld added a comment.
In http://reviews.llvm.org/D15920#347352, @beanz wrote:
> Is it correct to assume that all the test case changes are needed just to make the tests pass if you set CLANG_DEFAULT_CXX_STDLIB=libc++?
>
> [...]
Yes, most of the tests check for the correct `libstdc++` include paths which are not met with `libc++`.
================
Comment at: lib/Driver/ToolChain.cpp:549-550
@@ -536,9 +548,4 @@
+
ToolChain::CXXStdlibType ToolChain::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);
+ ToolChain::CXXStdlibType Type;
+ bool HasValidType = false;
----------------
I have moved the behaviour from `Darwin::TranslateArgs` to `Darwin::GetDefaultCXXStdlibType` and added this method for `Bitrig` as well (which was straightforward). `MIPS` only allows `libc++` so there is nothing the user can choose from...
I would have also liked to implement this for `FreeBSD` and `NetBSD` but their default library is dependent on the system version. While this wouldn't be a problem and could be implemented in `GetDefaultCXXStdlibType`, this would still be overriden by `CLANG_DEFAULT_CXX_STDLIB` which unfortunately fails the tests in `test/Driver/{freebsd.c,netbsd.c}`. Is it ok to leave this for now?
http://reviews.llvm.org/D15920
More information about the cfe-commits
mailing list