summaryrefslogtreecommitdiffstats
path: root/libcxx/src/exception.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [libc++] Remove redundant conditionals for Apple platformsLouis Dionne2019-04-231-2/+1
| | | | | | | | | | | | | | | | | | | Summary: In a bunch of places, we used to check whether LIBCXX_BUILDING_LIBCXXABI is defined OR we're building for an Apple platform. This used to be necessary in a time when Apple's build script did NOT define LIBCXX_BUILDING_LIBCXXABI. However this is not relevant anymore since Apple's build does define LIBCXX_BUILDING_LIBCXXABI. Reviewers: EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D60842 llvm-svn: 358988
* 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
* [libc++] Replace __sync_* functions with __libcpp_atomic_* functionsWeiming Zhao2017-09-191-0/+1
| | | | | | | | | | | | | | | | Summary: This patch replaces __sync_* with __libcpp_atomic_* and adds a wrapper function for __atomic_exchange to support _LIBCPP_HAS_NO_THREADS. Reviewers: EricWF, jroelofs, mclow.lists, compnerd Reviewed By: EricWF, compnerd Subscribers: compnerd, efriedma, cfe-commits, joerg, llvm-commits Differential Revision: https://reviews.llvm.org/D35235 llvm-svn: 313694
* [libc++] Implement exception_ptr on WindowsEric Fiselier2017-05-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements exception_ptr on Windows using the `__ExceptionPtrFoo` functions provided by MSVC. The `__ExceptionPtrFoo` functions are defined inside the C++ standard library, `msvcprt`, which is unfortunate because it requires libc++ to link to the MSVC STL. However this doesn't seem to cause any immediate problems. However to be safe I kept all usages within the libc++ dylib so that user programs wouldn't have to link to MSVCPRT as well. Note there are still 2 outstanding exception_ptr/nested_exception test failures. * `current_exception.pass.cpp` needs to be rewritten for the Windows exception_ptr semantics which copy the exception every time. * `rethrow_if_nested.pass.cpp` need investigation. It hits a stack overflow, likely from recursion. This patch also gets most of the `<future>` tests passing as well. Reviewers: mclow.lists, compnerd, bcraig, rmaprath, majnemer, BillyONeal, STL_MSFT Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D32927 llvm-svn: 302393
* Recommit "Split exception.cpp and new.cpp implementation into different ↵Eric Fiselier2017-02-101-312/+15
| | | | | | | | | | | | | | | | | | | | | | files for different runtimes." This recommits r294707 with additional fixes. The main difference is libc++ now correctly builds without any ABI library. exception.cpp is a bloody mess. It's full of confusing #ifdef branches for each different ABI library we support, and it's getting unmaintainable. This patch breaks down exception.cpp into multiple different header files, roughly one per implementation. Additionally it moves the definitions of exceptions in new.cpp into the correct implementation header. This patch also removes an unmaintained libc++abi configuration. This configuration may still be used by Apple internally but there are no other possible users. If it turns out that Apple still uses this configuration internally I will re-add it in a later commit. See http://llvm.org/PR31904. llvm-svn: 294730
* Revert "Split exception.cpp and new.cpp implementation into different files ↵Eric Fiselier2017-02-101-14/+312
| | | | | | | | for different runtimes." The compiler-rt CMake configuration needs some tweaking before this can land. llvm-svn: 294727
* Split exception.cpp and new.cpp implementation into different files for ↵Eric Fiselier2017-02-101-312/+14
| | | | | | | | | | | | | | | | | | | different runtimes. exception.cpp is a bloody mess. It's full of confusing #ifdef branches for each different ABI library we support, and it's getting unmaintainable. This patch breaks down exception.cpp into multiple different header files, roughly one per implementation. Additionally it moves the definitions of exceptions in new.cpp into the correct implementation header. This patch also removes an unmaintained libc++abi configuration. This configuration may still be used by Apple internally but there are no other possible users. If it turns out that Apple still uses this configuration internally I will re-add it in a later commit. See http://llvm.org/PR31904. llvm-svn: 294707
* Refer to _LIBCPP_MSVC macro where applicableSaleem Abdulrasool2017-02-061-6/+6
| | | | | | | | | Replace preprocess conditions of defined(_MSC_VER) && !defined(__clang__) with defined(_LIBCPP_MSVC). NFC. Patch by Dave Lee! llvm-svn: 294171
* [libc++] Implement terminate(), unexpected() and uncaught_exceptions() on ↵Eric Fiselier2017-01-071-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | | Windows Summary: This patch implements the following functions on Windows by forwarding to the MSVCRT: * `get_terminate()` * `set_terminate()` * `terminate()` * `set_unexpected()` * `get_unexpected()` * `unexpected()` * `uncaught_exception()` * `uncaught_exceptions()` Reviewers: compnerd, rnk, majnemer, smeenai Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28442 llvm-svn: 291343
* Recommit r290839 - Fix configuring and building libc++ w/o an ABI library.Eric Fiselier2017-01-031-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-4/+2
| | | | llvm-svn: 290841
* Fix configuring and building libc++ w/o an ABI library.Eric Fiselier2017-01-021-2/+4
| | | | | | | | | | | | | | | | | | | 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
* Mark libc++ internal globals with _LIBCPP_SAFE_STATIC.Eric Fiselier2016-09-281-2/+2
| | | | | | | | | | | | | This patch applies the _LIBCPP_SAFE_STATIC attribute to internal globals, most of which are locking primitives, in order to ensure that they can safely be used during program startup. This patch also fixes an unsafe static init issue with the global locks used to implement atomic operations on shared pointers. Previously the locks were initialized using a dynamically initialized pointer, so it was possible that the pointer was uninitialized. llvm-svn: 282640
* Remove a long-standing __has_include hack.Benjamin Kramer2015-10-161-7/+3
| | | | | | | | | 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
* Move uncaught_exeption() definition inside the #ifdef block like ↵Marshall Clow2015-06-021-1/+1
| | | | | | uncaught_exceptions() llvm-svn: 238879
* Implement uncaught_exceptions() using the newly added hooks in libc++abi, ↵Marshall Clow2015-06-021-5/+11
| | | | | | when available llvm-svn: 238846
* Fix building and testing libc++ with GCC.Eric Fiselier2015-05-201-1/+1
| | | | | | | | | | | | | | | | The changes in src/exception.cpp and cmake/Modules/HandleLibCXXABI.cmake fix a bug when building libc++ with GCC. Because GCC does not support __has_include we need to explicitly tell it that we are building against libc++abi via the preprocessor definition `LIBCXX_BUILDING_LIBCXXABI`. The changes in include/ratio are to work around CWG defect 1712 (constexpr variable template declarations). GCC 4.8 and before has not adopted the resolution to this defect. The changes in include/exception work around an issue where is_final is used without it being defined in type_traits. llvm-svn: 237767
* Print log/error messages on stderr, not stdoutEd Schouten2015-03-101-8/+8
| | | | | | | | | | | | There are a couple of places where libc++ prints log/error messages to stdout on its own. This may of course interfere with the output generated with applications. Log/error messages should be directed to stderr instead. Differential Revision: http://reviews.llvm.org/D8135 Reviewed by: marshall llvm-svn: 231767
* Partial fix for building w/ libcxxrt on OSX. Patch from C Bergstrom.Eric Fiselier2014-11-011-1/+1
| | | | llvm-svn: 221029
* Patch by Bruce Mitchener. Change all references to EMSCRIPTEN to ↵Marshall Clow2013-11-191-3/+3
| | | | | | __EMSCRIPTEN__. If you're not using the PP symbol EMSCRIPTEN, then you should see no functionality change. llvm-svn: 195136
* Patch from Bruce Mitchener; fixes two typos in comments. No functionality ↵Marshall Clow2013-11-111-1/+1
| | | | | | change. PR17843 llvm-svn: 194432
* Silence the unused function warning in exception.cpp.Peter Collingbourne2013-10-061-17/+16
| | | | | | | Rather than try to protect the function behind a precise, ever-changing #if expression, just inline it into every caller. llvm-svn: 192077
* Implement std::exception_ptr under libsupc++.Peter Collingbourne2013-10-061-12/+51
| | | | | | | | | | | | | | | | | libsupc++ does not implement the dependent EH ABI and the functionality it uses to implement std::exception_ptr (which it declares as an alias of std::__exception_ptr::exception_ptr) is not directly exported to clients. So we have little choice but to hijack std::__exception_ptr::exception_ptr's (which fortunately has the same layout as our std::exception_ptr) copy constructor, assignment operator and destructor (which are part of its stable ABI), and its rethrow_exception(std::__exception_ptr::exception_ptr) function. Also, remove some out of date comments. Differential Revision: http://llvm-reviews.chandlerc.com/D1826 llvm-svn: 192076
* Eliminate more symbols multiply defined between libsupc++ and libc++.Peter Collingbourne2013-10-061-0/+4
| | | | | | | | | | | | | | | The remaining multiple definitions were flushed out by attempting to link libsupc++ and libc++ into the same executable with --whole-archive, e.g. clang++ -I../llvm/projects/libcxx/include -nodefaultlibs -Wl,--whole-archive lib/libc++.a /usr/lib/gcc/x86_64-linux-gnu/4.6/libsupc++.a -Wl,--no-whole-archive -lgcc -lgcc_s -lc -lpthread -lrt (The same technique was used to flush out multiple definitions in libstdc++.) Differential Revision: http://llvm-reviews.chandlerc.com/D1824 llvm-svn: 192074
* G M: Provides the _LIBCPP_WARNING macro, to be used for MSVC only, since ↵Howard Hinnant2013-10-041-22/+52
| | | | | | that compiler doesn't support #warning. llvm-svn: 191980
* Add some friendly messages to libcxx calls to abort().Howard Hinnant2013-07-231-0/+9
| | | | llvm-svn: 186951
* Bruce Mitchener, Jr.: Port to emscripten. Fixes ↵Howard Hinnant2013-03-291-1/+3
| | | | | | http://llvm.org/bugs/show_bug.cgi?id=15624. llvm-svn: 178354
* Removed raw references to __APPLE__; now just check to see if it is defined.Marshall Clow2013-03-181-2/+2
| | | | llvm-svn: 177297
* Saleem Abdulrasool: __terminate_handler and __unexpected_handler are defined ↵Howard Hinnant2013-01-221-1/+1
| | | | | | | | | but not used when building against libsupc++ as the functions for which they are used are provided by libsupc++. Simply preprocess them away when building against libsupc++. llvm-svn: 173165
* [CMake] Add support for selecting which c++ abi library to use.Michael J. Spencer2012-11-301-3/+3
| | | | llvm-svn: 169036
* libc++: switch from using _ATTRIBUTE(noreturn) (which conflicts with aRichard Smith2012-07-261-4/+4
| | | | | | platform-provided macro on some systems) to _LIBCPP_NORETURN. llvm-svn: 160773
* Teach libc++ to check for libc++abi and use its features if they're available.Richard Smith2012-07-111-8/+11
| | | | llvm-svn: 160038
* Undo some overzealous #ifdefs for LIBCXXRT.David Chisnall2012-03-141-5/+9
| | | | llvm-svn: 152718
* I'm reverting one of the changes made to exception.cpp in r151717. I'm ↵Howard Hinnant2012-02-291-0/+4
| | | | | | unsure what the change was trying to do, but it didn't do the right thing for __APPLE__. So instead of trying to guess what was intended, I'm just putting it back the way it was. llvm-svn: 151727
* Some libcxxrt-compatibility cleanups (avoid defining things twice).David Chisnall2012-02-291-27/+25
| | | | llvm-svn: 151717
* Make attributes on definition consistent with those on declaration.Howard Hinnant2012-02-031-0/+1
| | | | llvm-svn: 149701
* Prepare for running on top of new libc++abi.Howard Hinnant2012-02-021-9/+17
| | | | llvm-svn: 149634
* Correct change to exception.cpp from r140245Howard Hinnant2011-09-211-1/+1
| | | | llvm-svn: 140253
* Fixes for FreeBSD, including some fairly obvious copy-and-paste errors.David Chisnall2011-09-211-14/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libc++ now mostly works on FreeBSD with libcxxrt and this patch applied to the base system: http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20110920/e666632c/xlocale-0001.obj Summary of tests on FreeBSD: **************************************************** Results for /root/libcxx/test: using FreeBSD clang version 3.0 (trunk 135360) 20110717 Target: x86_64-unknown-freebsd9.0 Thread model: posix with -std=c++0x -stdlib=libc++ -I/root/libcxx/include -L/root/libcxx/build/lib ---------------------------------------------------- sections without tests : 1 sections with failures : 48 sections without failures: 1015 + ---- total number of sections : 1064 ---------------------------------------------------- number of tests failed : 145 number of tests passed : 4179 + ---- total number of tests : 4324 **************************************************** (Many due to this clang version not supporting C++ atomics) More fixes to follow... llvm-svn: 140245
* Configure to get along with 2.9 clangHoward Hinnant2011-07-291-0/+1
| | | | llvm-svn: 136526
* Applied noexcept to everything in [language.support] (Chapter 18)Howard Hinnant2011-05-261-15/+15
| | | | llvm-svn: 132129
* Added [[noreturn]] attribute everywhere it should beHoward Hinnant2011-05-261-2/+4
| | | | llvm-svn: 132125
* Add a couple more std-qualifers.Howard Hinnant2010-12-061-2/+2
| | | | llvm-svn: 121002
* Fix up uses of new/terminate/unexpected handlers to use the new getters.Howard Hinnant2010-12-041-2/+2
| | | | llvm-svn: 120914
* N3189 Observers for the three handler functionsHoward Hinnant2010-12-021-6/+14
| | | | llvm-svn: 120712
* license changeHoward Hinnant2010-11-161-2/+2
| | | | llvm-svn: 119395
* Remove tabsHoward Hinnant2010-08-221-21/+21
| | | | llvm-svn: 111778
* Fixing whitespace problemsHoward Hinnant2010-08-221-35/+25
| | | | llvm-svn: 111751
* now works with -fno-exceptions and -fno-rttiHoward Hinnant2010-08-111-2/+8
| | | | llvm-svn: 110828
* [except.nested]Howard Hinnant2010-05-271-0/+17
| | | | llvm-svn: 104850
OpenPOWER on IntegriCloud