summaryrefslogtreecommitdiffstats
path: root/libcxx/src/stdexcept.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix ABI compatibility of `<stdexcept>` with VCRuntime.Eric Fiselier2019-03-061-81/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently, libc++'s `<stdexcept>` doesn't play nice with `vcruntime`. Specifically: * `logic_error` and `runtime_error` have a different layout. * libc++'s `logic_error` and `runtime_error` override `what()` but `vcruntime` does not. * `vcruntime` uses weak vtables for `<stdexcept>` types. * libc++'s `<stdexcept>` constructors and assignment operators may have different manglings than `vcruntimes`. This patch makes libc++'s declarations in `<stdexcept>` match those provided by MSVC's STL as closely as possible. If MSVC doesn't declare a special member, then neither do we. This ensures that the implicit definitions have the same linkage, visibility, triviality, and noexcept-ness. Reviewers: thomasanderson, ldionne, smeenai Reviewed By: thomasanderson Subscribers: jdoerfert, libcxx-commits Differential Revision: https://reviews.llvm.org/D58945 llvm-svn: 355546
* Make VCRuntime ABI configuration a first-class option.Eric Fiselier2019-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Summary: On Windows we currently provide two separate ABI configurations. One which defers to `vcruntime` to provide the C++ runtime and another which doesn't. Using `vcruntime` allows interoperability which programs compiled against the MSVC STL, and should be preferred whenever possible. When deferring to `vcruntime` much of the ABI we provide changes. Including the layout of `<stdexcept>` types, their vtables, and how the linkage of their members. This patch introduces the `_LIBCPP_ABI_VCRUNTIME` macro to denote this configuration. It also cleans up the existing configuration for using `vcruntime`. This cleanup lays the groundwork for fixing a number of ABI and interoperability bugs in `<stdexcept>`. Reviewers: thomasanderson, ldionne, smeenai Reviewed By: smeenai Subscribers: jdoerfert, libcxx-commits, #libc Differential Revision: https://reviews.llvm.org/D58942 llvm-svn: 355366
* [libc++] Don't define exception destructors when using vcruntimeThomas Anderson2019-01-301-15/+8
| | | | | | | | | | | | | Exception destructors are provided by vcruntime. Fixes link errors like: lld-link: error: duplicate symbol: "public: virtual __cdecl std::invalid_argument::~invalid_argument(void)" (??1invalid_argument@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj) lld-link: error: duplicate symbol: "public: virtual __cdecl std::length_error::~length_error(void)" (??1length_error@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj) lld-link: error: duplicate symbol: "public: virtual __cdecl std::out_of_range::~out_of_range(void)" (??1out_of_range@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj) lld-link: error: duplicate symbol: "public: virtual __cdecl std::overflow_error::~overflow_error(void)" (??1overflow_error@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj) Differential Revision: https://reviews.llvm.org/D57425 llvm-svn: 352646
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* Remove <__refstring> header; Move it into source directory.Eric Fiselier2017-07-121-1/+1
| | | | | | | | | | | | | | | | | | | | The libc++ <__refstring> headers has no real reason why it should be a public header that libc++ ships. The only reason it was in the include directory was because libc++abi needed it to build the library. However keeping <__refstring> a header had other problems, like requiring its dependancies to also be in the headers. For that reason this patch moves it into the source directory. To work around libc++abi's need for this header a duplicated copy was added to libc++abi in r307748. While duplicating the code is an unfortunate solution it's the best solution that's currently possible. In the future I would like to start a discussion on the mailing lists about making libc++abi build as a sub-project of libc++, requiring the libc++ sources always be present. llvm-svn: 307749
* Recommit r290839 - Fix configuring and building libc++ w/o an ABI library.Eric Fiselier2017-01-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch re-commits a previous attempt to support building libc++ w/o an ABI library. That patch was originally reverted because: 1) It forgot to teach the test suite about "default" ABI libraries. 2) Some LLVM builders don't clear the CMake cache between builds. The previous patch caused those builders to fail since their old cache entry for LIBCXX_CXX_ABI="" is no longer valid. The updated patch addresses both issues. It works around (2) by adding a hack to force the builders to update their cache entries. The hack will be removed shortly once all LLVM builders have run. Original commit message ----------------------- Typically libc++ uses libc++abi or libcxxrt to provide the ABI and runtime bits of the C++ STL. However we also support building w/o an ABI library entirely. This patch fixes building libc++ w/o an ABI library (and incorporates the `~type_info()` fix in D28211). The main changes in this patch are: 1) Add `-DLIBCXX_CXX_ABI=default` instead of using the empty string to mean "default". 2) Fix CMake bits which treated "none" as "default" on OS X. 3) Teach the source files to respect `-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY`. 4) Define ~type_info() when _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY is defined. Unfortunately this patch doesn't help clean up the macro mess that we use to configure for different ABI libraries. llvm-svn: 290849
* Revert r290839 - Fix configuring and building libc++ w/o an ABI libraryEric Fiselier2017-01-021-2/+1
| | | | llvm-svn: 290841
* Fix configuring and building libc++ w/o an ABI library.Eric Fiselier2017-01-021-1/+2
| | | | | | | | | | | | | | | | | | | Typically libc++ uses libc++abi or libcxxrt to provide the ABI and runtime bits of the C++ STL. However we also support building w/o an ABI library entirely. This patch fixes building libc++ w/o an ABI library (and incorporates the `~type_info()` fix in D28211). The main changes in this patch are: 1) Add `-DLIBCXX_CXX_ABI=default` instead of using the empty string to mean "default". 2) Fix CMake bits which treated "none" as "default" on OS X. 3) Teach the source files to respect `-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY`. 4) Define ~type_info() when _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY is defined. Unfortunately this patch doesn't help clean up the macro mess that we use to configure for different ABI libraries. llvm-svn: 290839
* [libc++] Fix modules build - Rework __refstring definition Eric Fiselier2016-10-251-1/+2
| | | | | | | | | | | | | | | Summary: `__libcpp_refstring` currently has two different definitions. First there is the complete definition in `<__refstring>` but there is also a second in `<stdexcept>`. The historical reason for this split is because both libc++ and libc++abi need to see the inline definitions of __libcpp_refstrings methods, but the `<stdexcept>` header doesn't. However this is an ODR violation and breaks the modules build. This patch fixes the issue by creating a single class definition in `<stdexcept>` and changing `<__refstring>` to contain only the inline method definitions. This way both `libcxx/src/stdexcept.cpp` and `libcxxabi/src/stdexcept.cpp` see the same declaration in `<stdexcept>` and definitions in `<__refstring>` Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25603 llvm-svn: 285100
* Fix an unfortunate yet old typo that never got attention before r250507.Benjamin Kramer2015-10-161-1/+1
| | | | | | Should fix the xcode libc++ build. llvm-svn: 250508
* Remove a long-standing __has_include hack.Benjamin Kramer2015-10-161-5/+1
| | | | | | | | | This was put in to get libc++ building without libcxxabi. We now have macros that show that we are building against libcxxabi so use that instead. This guards against existing but broken cxxabi.h headers on the system. llvm-svn: 250507
* Exceptions store the message as reference counted string forJoerg Sonnenberger2014-04-301-110/+14
| | | | | | | | | compatibility to libstdc++. Move the implementation into a header for easier sharing with libc++abi. Merge a number of improvements from that version. Provide a POD definition for <stdexcept>'s public use to avoid cast dances. Discussed with Marshall Clow. llvm-svn: 207695
* Adjust build fix from r199494 to use C++ castsAlp Toker2014-01-171-1/+1
| | | | | | Change suggested by Joerg Sonnenberger! llvm-svn: 199500
* Build fix for gcc builtinAlp Toker2014-01-171-1/+1
| | | | | | | | | | The __sync_add_and_fetch() builtin parameter is volatile but clang has 'different' type checking and ends up accepting this code. Undo the C++ cast from r198505 to get libc++/LLVM building with g++ while this is investigated. llvm-svn: 199494
* Replace casts of __impl_ with the correct reinterpret_cast of theJoerg Sonnenberger2014-01-071-16/+16
| | | | | | address. Restores the assembly of before r198504. llvm-svn: 198698
* Switch to using C++ style casts.Joerg Sonnenberger2014-01-041-29/+31
| | | | llvm-svn: 198505
* Make it possible to link against libstdc++ as well as libsupc++ with CMake.Peter Collingbourne2013-10-061-2/+2
| | | | | | | | | | | | | | | Linking against libstdc++, rather than libsupc++, is probably better for people who need to link against clients of libstdc++. Because libsupc++ is provided only as a static library, its globals are not shared between the static library and the copy linked into libstdc++. This has been found to cause at least one test failure. This also removes a number of symbols which were multiply defined between libstdc++ and libc++, only when linking with libstdc++. Differential Revision: http://llvm-reviews.chandlerc.com/D1825 llvm-svn: 192075
* G M: A small patch to fix a couple of warnings in stdexcept.cpp for cl.exe ↵Howard Hinnant2013-10-041-0/+4
| | | | | | which does not support #pragma visibility. llvm-svn: 191988
* Glen: replace obsolete _LIBCPP_CANTTHROW with _NOEXCEPT.Howard Hinnant2013-08-221-5/+5
| | | | llvm-svn: 189046
* Matthew Dempsky: Same as stdexcept.cpp in libc++abi: we've already computed ↵Howard Hinnant2013-06-291-1/+1
| | | | | | 'len strlen(msg)', so we can use memcpy() instead of strcpy(). llvm-svn: 185274
* Removed raw references to __APPLE__; now just check to see if it is defined.Marshall Clow2013-03-181-1/+1
| | | | llvm-svn: 177297
* Some minor mingw64 porting tweaks from Glen.Howard Hinnant2012-09-031-2/+7
| | | | llvm-svn: 163120
* Change size of reference count field in __libcpp_nmstr from 32 bits to 64 ↵Howard Hinnant2012-08-081-3/+3
| | | | | | bits for 64 bit targets. This is controls the data layout of all exceptions defined in <stdexcept>. This aligns the ABI with that of gcc-4.2. llvm-svn: 161497
* libc++: only #include <cxxabi.h> if it exists. This allows libc++ to buildRichard Smith2012-04-191-0/+4
| | | | | | | | out of the box on Linux systems. If you're building against libc++abi, you still need to make sure it can find <cxxabi.h> so it knows not to export symbols which libc++abi provides. llvm-svn: 155091
* Move typeinfos for exceptions in <stdexcept> to the abiHoward Hinnant2012-02-171-0/+9
| | | | llvm-svn: 150835
* Applied noexcept to everything in [diagnostics] (Chapter 19)Howard Hinnant2011-05-261-17/+17
| | | | llvm-svn: 132137
* license changeHoward Hinnant2010-11-161-2/+2
| | | | llvm-svn: 119395
* Fix typos, noticed by Clang.Daniel Dunbar2010-09-041-1/+1
| | | | llvm-svn: 113061
* patch by Jeffrey Yasskin for porting to Ubuntu Hardy. Everything was ↵Howard Hinnant2010-05-241-5/+4
| | | | | | accepted except there were some bug fixes needed in <locale> for the __nolocale_* series. For the apple branch I ended up using templates instead of the var_args solution because it seemed both safer and more efficient. llvm-svn: 104516
* Wiped out some non-ascii characters that snuck into the copyright.Howard Hinnant2010-05-111-1/+1
| | | | llvm-svn: 103516
* libcxx initial importHoward Hinnant2010-05-111-0/+179
llvm-svn: 103490
OpenPOWER on IntegriCloud