r193934 - Default to use libc++ on OS X 10.9+ and iOS 7+.

Howard Hinnant hhinnant at apple.com
Tue Nov 5 09:42:22 PST 2013


When I use tot clang, (and want libc++), I will forbid clang from looking the std::headers, and then tell it exactly where the headers are, e.g.:

$ clang++ -stdlib=libc++ -std=c++11 -nostdinc++ -I../libcxx/include test.cpp 

Howard

On Nov 5, 2013, at 12:35 PM, Nico Weber <thakis at chromium.org> wrote:

> In addition to the performance issues, libc++ apparently can't be found by clang: http://llvm.org/bugs/show_bug.cgi?id=17821
> 
> 
> On Sat, Nov 2, 2013 at 10:35 PM, Bob Wilson <bob.wilson at apple.com> wrote:
> I’m not familiar with those performance issues, so I’m CC’ing Howard in case he can provide any details on those issues.  In general, we’re in the process of migrating away from libstdc++ on OS X and iOS, so we really do want the default to be libc++ regardless of the language mode.  If you have particularly performance sensitive code, you can always choose to use libstdc++.
> 
> On Nov 2, 2013, at 7:05 PM, Nico Weber <thakis at chromium.org> wrote:
> 
>> Thanks for upstreaming this!
>> 
>> Should this only happen in C++11 mode? libc++ seems to be measurably slower than libstdc++ in C++03 mode (PR17703, PR14554, PR14555).
>> 
>> 
>> On Sat, Nov 2, 2013 at 4:19 PM, Bob Wilson <bob.wilson at apple.com> wrote:
>> Author: bwilson
>> Date: Sat Nov  2 18:19:53 2013
>> New Revision: 193934
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=193934&view=rev
>> Log:
>> Default to use libc++ on OS X 10.9+ and iOS 7+.
>> 
>> Modified:
>>     cfe/trunk/lib/Driver/ToolChains.cpp
>>     cfe/trunk/test/PCH/cxx-typeid.cpp
>> 
>> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=193934&r1=193933&r2=193934&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
>> +++ cfe/trunk/lib/Driver/ToolChains.cpp Sat Nov  2 18:19:53 2013
>> @@ -839,6 +839,12 @@ DerivedArgList *Darwin::TranslateArgs(co
>>      }
>>    }
>> 
>> +  // Default to use libc++ on OS X 10.9+ and iOS 7+.
>> +  if (((isTargetMacOS() && !isMacosxVersionLT(10, 9)) ||
>> +       (isTargetIPhoneOS() && !isIPhoneOSVersionLT(7, 0))) &&
>> +      !Args.getLastArg(options::OPT_stdlib_EQ))
>> +    DAL->AddJoinedArg(0, Opts.getOption(options::OPT_stdlib_EQ), "libc++");
>> +
>>    // Validate the C++ standard library choice.
>>    CXXStdlibType Type = GetCXXStdlibType(*DAL);
>>    if (Type == ToolChain::CST_Libcxx) {
>> 
>> Modified: cfe/trunk/test/PCH/cxx-typeid.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx-typeid.cpp?rev=193934&r1=193933&r2=193934&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/PCH/cxx-typeid.cpp (original)
>> +++ cfe/trunk/test/PCH/cxx-typeid.cpp Sat Nov  2 18:19:53 2013
>> @@ -1,8 +1,8 @@
>>  // Test this without pch.
>> -// RUN: %clang_cc1 -include %S/cxx-typeid.h -fsyntax-only -verify %s
>> +// RUN: %clang_cc1 -include %S/cxx-typeid.h -fsyntax-only -stdlib=libstdc++ -verify %s
>> 
>> -// RUN: %clang_cc1 -x c++-header -emit-pch -o %t.pch %S/cxx-typeid.h
>> -// RUN: %clang_cc1 -include-pch %t.pch -fsyntax-only -verify %s
>> +// RUN: %clang_cc1 -x c++-header -emit-pch -stdlib=libstdc++ -o %t.pch %S/cxx-typeid.h
>> +// RUN: %clang_cc1 -include-pch %t.pch -fsyntax-only -stdlib=libstdc++ -verify %s
>> 
>>  // expected-no-diagnostics
>> 
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>> 
> 
> 





More information about the cfe-commits mailing list