summaryrefslogtreecommitdiffstats
path: root/libcxx
Commit message (Collapse)AuthorAgeFilesLines
* [libc++] Speed up certain locale functions on WindowsThomas Anderson2019-03-191-0/+6
| | | | | | | | | | | The issue is that __libcpp_locale_guard makes some slow calls to setlocale(). This change avoids using __libcpp_locale_guard in snprintf_l(). Fixes https://bugs.llvm.org/show_bug.cgi?id=41131 Differential Revision: https://reviews.llvm.org/D59525 llvm-svn: 356512
* Revert "[libc++] Build <filesystem> support as part of the dylib"Louis Dionne2019-03-19163-210/+14305
| | | | | | | | When I applied r356500 (https://reviews.llvm.org/D59152), I somehow deleted all of filesystem's tests. I will revert r356500 and re-apply it properly. llvm-svn: 356505
* Fix char.traits.specializations.char8_t main returnJF Bastien2019-03-194-0/+4
| | | | llvm-svn: 356504
* Fixup ABI lists on Linux after adding <filesystem> to the dylib.Eric Fiselier2019-03-191-0/+71
| | | | llvm-svn: 356503
* Add visibility attributes and inline to some vector methods.Eric Fiselier2019-03-191-3/+8
| | | | | | | Adding filesystem to the dylib caused some vector symbols to leak into the set of exported symbols. This patch hides those symbols. llvm-svn: 356502
* [libc++] Build <filesystem> support as part of the dylibLouis Dionne2019-03-19163-14305/+210
| | | | | | | | | | | | | | | | Summary: This patch treats <filesystem> as a first-class citizen of the dylib, like all other sub-libraries (e.g. <chrono>). As such, it also removes all special handling for installing the filesystem library separately or disabling part of the test suite from the lit command line. Reviewers: mclow.lists, EricWF, serge-sans-paille Subscribers: mgorny, christof, jkorous, dexonsmith, jfb, jdoerfert, libcxx-commits Differential Revision: https://reviews.llvm.org/D59152 llvm-svn: 356500
* Fix fenv.pass.cpp signature for mainJF Bastien2019-03-191-3/+1
| | | | | | And make main return. llvm-svn: 356493
* [libc++] Mark internal types of std::filesystem as hiddenLouis Dionne2019-03-191-3/+3
| | | | | | | | | | | | | | | | | | Summary: Otherwise, implicit instantiations of templates with these types can cause the dylib to start exporting the vtable/RTTI of the instantiation. Giving hidden visibility to those types causes the compiler to understand that they are not used outside the dylib, and as a result implicitly instantiated vtables/RTTI of templates with those internal types will get hidden visibility. Reviewers: EricWF Subscribers: christof, jkorous, dexonsmith, jdoerfert, libcxx-commits Differential Revision: https://reviews.llvm.org/D59550 llvm-svn: 356488
* Mark 'front()' and 'back()' as noexcept for array/deque/string/string_view. ↵Marshall Clow2019-03-1912-45/+94
| | | | | | These are just rebranded 'operator[]', and should be noexcept like it is. llvm-svn: 356435
* Remove unused try catch blocks from old debug testsEric Fiselier2019-03-191-26/+14
| | | | llvm-svn: 356429
* Fix test failures after debug mode changesEric Fiselier2019-03-181-3/+3
| | | | llvm-svn: 356421
* Remove exception throwing debug mode handler support.Eric Fiselier2019-03-1827-769/+910
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The reason libc++ implemented a throwing debug mode handler was for ease of testing. Specifically, I thought that if a debug violation aborted, we could only test one violation per file. This made it impossible to test debug mode. Which throwing behavior we could test more! However, the throwing approach didn't work either, since there are debug violations underneath noexcept functions. This lead to the introduction of `_NOEXCEPT_DEBUG`, which was only noexcept when debug mode was off. Having thought more and having grown wiser, `_NOEXCEPT_DEBUG` was a horrible decision. It was viral, it didn't cover all the cases it needed to, and it was observable to the user -- at worst changing the behavior of their program. This patch removes the throwing debug handler, and rewrites the debug tests using 'fork-ing' style death tests. Reviewers: mclow.lists, ldionne, thomasanderson Reviewed By: ldionne Subscribers: christof, arphaman, libcxx-commits, #libc Differential Revision: https://reviews.llvm.org/D59166 llvm-svn: 356417
* [libc++][NFC] Promote CMake comment to an actual option descriptionLouis Dionne2019-03-181-3/+3
| | | | llvm-svn: 356386
* [libc++] Add a test for PR40977Louis Dionne2019-03-181-0/+34
| | | | | | | Even though the header makes the exact same check since https://llvm.org/D59063, the headers could conceivably change in the future and introduce a bug. llvm-svn: 356376
* Update a deque test with more assertions. NFCMarshall Clow2019-03-151-6/+6
| | | | llvm-svn: 356266
* Mark vector::operator[] and front/back as noexcept. We already do this for ↵Marshall Clow2019-03-153-8/+130
| | | | | | string and string_view. This should give better codegen inside of noexcept functions. Add tests for op[]/front/back/at, because apparently we had none. llvm-svn: 356224
* XFAIL this debug-mode test that I just broke. Eric has a patch out for ↵Marshall Clow2019-03-141-1/+1
| | | | | | review (D59166) that rewrites this test completely, so I'm not going to bother fixing it. llvm-svn: 356211
* Add noexcept to operator[] for array and deque. This is an extension. We ↵Marshall Clow2019-03-144-12/+37
| | | | | | already do this for string and string_view. This should give better codegen inside of noexcept functions. llvm-svn: 356209
* Reorg the midpoint pointer test into runtime and constexpr tests; comment ↵Marshall Clow2019-03-141-10/+40
| | | | | | out the volatile constexpr tests for GCC because our experimental gcc bot barfs on them. llvm-svn: 356177
* Fix two of the three bot failures for midpoint; the ones regarding the lack ↵Marshall Clow2019-03-142-2/+8
| | | | | | of '__int128_t' llvm-svn: 356169
* [libc++][CMake] Do not define `cxx_shared_EXPORTS` when building the shared ↵Louis Dionne2019-03-141-0/+1
| | | | | | | | | | | | library CMake will define -Dcxx_shared_EXPORTS when building the shared library by default. In theory, this is used to signal to the library that we're building a shared library and that dllimport/dllexport should be used. However, we already have our own way of doing that, so I'm removing this define to avoid meaningless command line arguments in the build. llvm-svn: 356167
* Add std::midpoint for integral and poiner types. Described in P0811, ↵Marshall Clow2019-03-145-0/+322
| | | | | | reviewed as D59099. llvm-svn: 356162
* [libc++][CMake] Fix typo introduced in r356150Louis Dionne2019-03-141-1/+1
| | | | | | That typo broke the build when the shared library build was disabled. llvm-svn: 356155
* [libc++] Do not force building with -fPIC (re-applying)Louis Dionne2019-03-141-4/+0
| | | | | | | | | | | | | | | | | | | | | | | Summary: In r355746, we stopped forcing to build with -fPIC because that should be specified by the CMAKE_POSITION_INDEPENDENT_CODE option at CMake configure time (and by default -fPIC is used for shared libraries anyways). However, r355746 had to be reverted in r355756 because we were not actually building the shared library with -fPIC. The reason is that we were sharing an object library between the static and the shared library, which caused flags for static libraries to be used when building object files that were going to be used for a shared library. Since this was resolved by r356150, we can stop forcing -fPIC again. Reviewers: EricWF, smeenai Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D59250 llvm-svn: 356153
* [libc++] Do not share an object library to create the static/shared librariesLouis Dionne2019-03-141-38/+19
| | | | | | | | | | | | | | | | | | | | | | Summary: The problem with using an object library for doing this is that it prevents the shared library and the static library from being built with the right default flags. For example, CMake will build shared libraries with -fPIC by default, but not static libraries. Using an object library to create the shared library will prevent the right default flags for shared libraries from being used. As a side effect, this patch also localizes the logic related to building a hermetic static library to the static library case, making clear that this has no effect on the shared library. Reviewers: phosek, EricWF Subscribers: mgorny, christof, jkorous, dexonsmith, jdoerfert, libcxx-commits Differential Revision: https://reviews.llvm.org/D59248 llvm-svn: 356150
* Properly constrain basic_string(Iter, Iter, Alloc = A())Eric Fiselier2019-03-142-4/+13
| | | | llvm-svn: 356140
* [libc++] Enable deprecation warnings by defaultLouis Dionne2019-03-1287-38/+157
| | | | | | | | | | | | | | | | | | | Summary: In r342843, I added deprecation warnings to some facilities that were deprectated in C++14 and C++17. However, those deprecation warnings were not enabled by default. After discussing this on IRC, we had finally gotten consensus to enable those warnings by default, and I'm getting around to doing that only now. Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, jdoerfert, libcxx-commits Differential Revision: https://reviews.llvm.org/D58140 llvm-svn: 355961
* Allow optional to tolerate being used with a nested class.Eric Fiselier2019-03-112-3/+48
| | | | | | | | | | | | | | | When Clang tries to complete a type containing `std::optional` it considers the `in_place_t` constructor with no arguments which checks if the value type is default constructible. If the value type is a nested class type, then this check occurs too early and poisons the is_default_constructible trait. This patch makes optional deduce `in_place_t` so we can prevent this early SFINAE evaluation. Technically this could break people doing weird things with the in_place_t tag, but that seems less important than making the nested class case work. llvm-svn: 355877
* [libc++] Remove empty header xlocale/xlocale.hLouis Dionne2019-03-112-1/+0
| | | | | | | | | | | | | | Summary: I can't think of a reason for shipping this empty header. If there is a reason to do so, then hopefully this review can uncover it. Reviewers: mclow.lists, EricWF Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D59137 llvm-svn: 355829
* LWG 2843 "Unclear behavior of std::pmr::memory_resource::do_allocate()"Eric Fiselier2019-03-092-11/+15
| | | | | | | | | | | | | | | | | | | | Patch by Arthur O'Dwyer. Reviewed as https://reviews.llvm.org/D47344 new_delete_resource().allocate(n, a) has basically two permissible results: * Return an appropriately sized and aligned block. * Throw bad_alloc. Before this patch, libc++'s new_delete_resource would do a third and impermissible thing, which was to return an appropriately sized but inappropriately under-aligned block. This is now fixed. (This came up while I was stress-testing unsynchronized_pool_resource on my MacBook. If we can't trust the default resource to return appropriately aligned blocks, pretty much everything breaks. For similar reasons, I would strongly support just patching __libcpp_allocate directly, but I don't care to die on that hill, so I made this patch as a <memory_resource>-specific workaround.) llvm-svn: 355763
* Work around dllimport bug with exclude_from_explicit_instantiation.Eric Fiselier2019-03-081-0/+3
| | | | | | | | | | | | When dllimport is specified on a class, and exclude_from_explicit_instatiation is specified on a member, clang-cl will still expect a definition to be available externally. But this is not correct. Surprisingly one one symbol seems to be consistently affected by this bug. So this patch simply works around it there. llvm-svn: 355760
* Fix C++03 build failureEric Fiselier2019-03-081-1/+1
| | | | llvm-svn: 355758
* Revert "[libc++] Do not force building with -fPIC"Eric Fiselier2019-03-081-0/+4
| | | | | | | | | | This reverts commit r355764. CMake does not turn -fPIC on for us by default. so this patch breaks standalone builds. The only reason it hasn't broken any bots is because LLVM turns on and specifies '-fPIC' for us. llvm-svn: 355756
* Unbork `std::memory_order` ABI.Eric Fiselier2019-03-081-6/+29
| | | | | | | | | | | | | | | | | | | Summary: We need to pin the underlying type of C++20' `std::memory_order` to match the C++17 version. Anything less is an ABI break. At the moment it's `unsigned` before C++20 and `int` after. Or if you're using `-fshort-enums` it's `unsigned char` before C++20 and `int` after. This patch explicitly specifies the underlying type of the C++20 `memory_order` to be w/e type the compiler would have chosen for the C++17 version. Reviewers: mclow.lists, ldionne Reviewed By: ldionne Subscribers: jfb, jdoerfert, #libc, zoecarver Differential Revision: https://reviews.llvm.org/D59063 llvm-svn: 355755
* Fix PR41017 - Build failure with _LIBCPP_DEBUG=0 and non-const-refEric Fiselier2019-03-082-7/+32
| | | | | | | | | | | comparator for std::sort() Our debug comparator assumed that the comparator it wraps would always accepts the values by const ref. This isn't required by the standard. This patch makes our __debug_less comparator forward the constness. llvm-svn: 355752
* [libc++] Do not force building with -fPICLouis Dionne2019-03-081-4/+0
| | | | | | | | | | | | | | | | Summary: Whether we build with -fPIC should be specified by the CMAKE_POSITION_INDEPENDENT_CODE option at configure time. Note that this patch doesn't change the behavior when building by default, since -fPIC is used for shared libraries by default. Reviewers: EricWF Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D59146 llvm-svn: 355746
* [NFC] Add missing revision information to ABI ChangelogLouis Dionne2019-03-081-1/+1
| | | | llvm-svn: 355732
* Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"Matthew Voss2019-03-082-14/+12
| | | | | | | | This broke the windows bots. This reverts commit 28302c66d2586074f77497d5dc4eac7182b679e0. llvm-svn: 355725
* [runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/Petr Hosek2019-03-082-12/+14
| | | | | | | | | | | | | | | This change is a consequence of the discussion in "RFC: Place libs in Clang-dedicated directories", specifically the suggestion that libunwind, libc++abi and libc++ shouldn't be using Clang resource directory. Tools like clangd make this assumption, but this is currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build. This change addresses that by moving the output of these libraries to lib/<target> and include/ directories, leaving resource directory only for compiler-rt runtimes and Clang builtin headers. Differential Revision: https://reviews.llvm.org/D59013 llvm-svn: 355665
* [libc++] Fix use-after-free when building with _LIBCPP_DEBUG=1Thomas Anderson2019-03-062-41/+53
| | | | | | | | | | | | | | | | | | | | | | | The issue is the following code: __cn1->__add(*__ip); (*__ip)->__c_ = __cn1; `__ip` points into the array of iterators for container `__cn2`. This code adds the iterator to the array of iterators for `__cn1`, and updates the iterator to point to the new container. This code works fine, except when `__cn1` and `__cn2` are the same container. `__cn1->__add()` might need to grow the array of iterators, and when it does, `__ip` becomes invalid, so the second line becomes a use-after-free error. Simply swapping the order of the above two lines is not sufficient, because of the memmove() below. The easiest and most performant solution is just to skip touching any iterators if the containers are the same. Differential Revision: https://reviews.llvm.org/D58926 llvm-svn: 355550
* Fix ABI compatibility of `<stdexcept>` with VCRuntime.Eric Fiselier2019-03-064-82/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [libc++] Do not specify the underlying type of memory_orderLouis Dionne2019-03-061-8/+2
| | | | | | | | | | | | | | | | Summary: This breaks ABI for folks using -fshort-enums, and does not really buy us anything. http://llvm.org/PR40977 Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits, zoecarver Differential Revision: https://reviews.llvm.org/D59029 llvm-svn: 355521
* Eradicate all the ptrdiff_ts in span left over from applying P1227. A couple ↵Marshall Clow2019-03-0612-67/+66
| | | | | | of other minor cleanups. NFC llvm-svn: 355481
* [libc++] Only add dylib-related features when using the system's libc++Louis Dionne2019-03-051-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise, when testing trunk libc++ on an older system, lit will think that the dylib features are disabled. Ideally, we'd have a notion of running the tests with/without a deployment target (or, equivalently, a deployment target representing trunk where everything is as recent as can be). Since we always have a deployment target right now (which defaults to the current system), we only enable those features when we're going to also be testing with the system libc++. We also need to disable the availability markup when we are not running a system library flavor, because availability markup does not make sense when building against the trunk libc++ (which has everything regardless of what the current system is). This is a re-application of r353319, which had been reverted due to CI breakage. This time around, I made sure it didn't break our internal CI before submitting. This is also a partial undoing of r348296, in spirit at least. However, with this patch, availability markup is enabled based on whether we're using a system library or not, whereas previously one could enable it or disable it arbitrarily. This was confusing as it led to testing configurations that don't make sense (such as testing a system library without availability markup, or trunk testing with availability markup). llvm-svn: 355451
* Reinstate libc++ patches now that the lldb formatter has been updated.Davide Italiano2019-03-056-281/+856
| | | | | | | | "[libc++] Fix <atomic> failures on GCC" "[libc++] Change memory_order to an enum class" "[libc++] decoupling Freestanding atomic<T> from libatomic.a" llvm-svn: 355427
* [libcxx] Revert set of atomic patches that broke lldb.Davide Italiano2019-03-056-856/+281
| | | | | | | | | | | Revert "[libc++] Fix <atomic> failures on GCC" Revert "[libc++] Change memory_order to an enum class" Revert "[libc++] decoupling Freestanding atomic<T> from libatomic.a" The lldb formatter nededs to be updated. Shafik and Louis will coordinate to do so. llvm-svn: 355417
* [libc++] Fix <atomic> failures on GCCLouis Dionne2019-03-052-103/+103
| | | | | | | | | | | | | | | | Summary: In https://reviews.llvm.org/D58201, we turned memory_order into an enum class in C++20 mode. However, we were not casting memory_order to its underlying type correctly for the GCC implementation, which broke the build bots. I also fixed a test that was failing in C++17 mode on GCC 5. Reviewers: EricWF, jfb, mclow.lists Subscribers: zoecarver Differential Revision: https://reviews.llvm.org/D58966 llvm-svn: 355409
* [libc++] Change memory_order to an enum classLouis Dionne2019-03-054-59/+115
| | | | | | | | | This implements P0439R0. Thanks to Zoe Carver for the patch. Differential Revision: https://reviews.llvm.org/D58201 llvm-svn: 355403
* Fix -fsanitize=vptr badness in <__debug>Eric Fiselier2019-03-058-16/+52
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes a lifetime bug when inserting a new container into the debug database. It is diagnosed by UBSAN when debug mode is enabled. This patch corrects how nodes are constructed during insertion. The fix requires unconditionally breaking the debug mode ABI. Users should not expect ABI stability from debug mode. Reviewers: ldionne, serge-sans-paille, EricWF Reviewed By: EricWF Subscribers: mclow.lists, christof, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D58011 llvm-svn: 355367
* Make VCRuntime ABI configuration a first-class option.Eric Fiselier2019-03-058-24/+24
| | | | | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud