[Lldb-commits] [PATCH] Switch LLDB to C++11 and libc++

Benjamin Kramer benny.kra at googlemail.com
Wed Feb 22 14:39:53 PST 2012

libstdc++ on OS X is an ancient version on its way out. libc++ provides a more modern implementation and has been available with Xcode for some time now. However, switching to libc++ isn't entirely trivial, as it doesn't supply the tr1/ headers, they have moved into the main std:: namespace with the c++11 revision. This could be worked around with preprocessor defines but I figured it would be simpler to just drop support for the old libstdc++.

Building in C++11 mode with libc++ gives us some advantages even without using the new features, such as move semantics for the STL containers to avoid unnecessary copies. The new features can come in helpful too though (think of auto).

The actual patch isn't very spectacular, mostly s/tr1// and various build system tweaks. There are some caveats though.

- Using the Makefile based build system on the mac requires manual supplying of -stdlib=libc++. This will hopefully be fixed on the LLVM side of the build system eventually.
- llvm.zip needs to be rebuilt (I didn't include it in this mail for size reasons)
- If you want to build with g++, you'll need at least g++ 4.5 (same for libstdc++)
- For Xcode it requires a fairly recent version (4.3 or 4.2 should work)
- If you have a project that links against the public C++ API it has to be built with -stdlib=libc++ as well.

This change introduces some warnings (which are trivial to fix). I left them in so the patch doesn't get more noisy.

Please let me know what you think about this change!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lldb-cxx11.patch
Type: application/octet-stream
Size: 31504 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20120222/09469920/attachment.obj>
-------------- next part --------------


More information about the lldb-commits mailing list