[PATCH] D15920: [CMake] Add option to switch default C++ stdlib

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 9 19:46:45 PST 2016


rsmith added a subscriber: rsmith.
rsmith added a comment.

The direction here generally seems fine to me.


================
Comment at: lib/Driver/ToolChain.cpp:538
@@ -536,7 +537,3 @@
 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;
+  StringRef CXXStdlibName(CLANG_DEFAULT_CXX_STDLIB);
+
----------------
On Darwin, this default will be clobbered by the code in `Darwin::TranslateArgs` in ToolChains.cpp. On MIPS, this override will take no effect because `GetCXXStdlibType` is overridden.

Perhaps we could instead default `CLANG_DEFAULT_CXX_STDLIB` to `""`, and let the tool chain pick the default if it's neither specified at configure time nor on the command line.


http://reviews.llvm.org/D15920





More information about the cfe-commits mailing list