summaryrefslogtreecommitdiffstats
path: root/libcxx
Commit message (Collapse)AuthorAgeFilesLines
* Fix undefined behavior in __hash_tableEric Fiselier2016-07-235-243/+234
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch attempts to fix the undefined behavior in __hash_table by changing the node pointer types used throughout. The pointer types are changed for raw pointers in the current ABI and for fancy pointers in ABI V2 (since the fancy pointer types may not be ABI compatible). The UB in `__hash_table` arises because tree downcasts the embedded end node and then deferences that pointer. Currently there are 2 node types in __hash_table: * `__hash_node_base` which contains the `__next_` pointer. * `__hash_node` which contains `__hash_` and `__value_`. Currently the bucket list, iterators, and `__next_` pointers store pointers to `__hash_node` even though they all need to store `__hash_node_base` pointers. This patch makes that change by introducing a `__next_pointer` typedef which is a pointer to `__hash_node` in the current ABI and `__hash_node_base` afterwards. One notable change is to the type of `__bucket_list` which used to be defined as `unique_ptr<__node_pointer[], ...>` and is now `unique_ptr<__next_pointer[], ...>` meaning that we now allocate and deallocate different types using a different allocator. I'm going to give this part of the change more thought since it may introduce compatibility issues. This change is similar to D20786. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D20787 llvm-svn: 276533
* Implement P0392r0. Integrate filesystem::path and string_view.Eric Fiselier2016-07-239-70/+211
| | | | llvm-svn: 276511
* Revert r276506 - Diagnose invalid memory order arguments in <atomic>.Eric Fiselier2016-07-232-203/+0
| | | | | | | | There is a bug in Clang 3.6 and earlier that causes compile failures. I suspect it's due to the usage of member function parameter names in the attributes. llvm-svn: 276507
* [libcxx] Diagnose invalid memory order arguments in <atomic>. Fixes PR21179.Eric Fiselier2016-07-232-0/+203
| | | | | | | | | | | | | | | Summary: This patch uses the __attribute__((enable_if)) hack suggested by @rsmith to diagnose invalid arguments when possible. In order to diagnose an invalid argument `m` to `f(m)` we provide an additional overload of `f` that is only enabled when `m` is invalid. When that function is enabled it uses __attribute__((unavailable)) to produce a diagnostic message. Reviewers: mclow.lists, rsmith, jfb, EricWF Subscribers: bcraig, jfb, rsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D22557 llvm-svn: 276506
* Remove FIXME for feature test macroJF Bastien2016-07-211-1/+0
| | | | | | The value I'd picked was correct, as per the recently published SG10 paper http://wg21.link/p0096r3 llvm-svn: 276309
* Again, w/o the tabsMarshall Clow2016-07-211-5/+5
| | | | llvm-svn: 276273
* Another fix to appease the no-exception bots.Marshall Clow2016-07-211-7/+11
| | | | llvm-svn: 276272
* Fix some string_view tests that were failing when exceptions were disabled. ↵Marshall Clow2016-07-216-9/+34
| | | | | | Also comment out a _LIBCPP_ASSERT that gcc4.9 was complaining about. Will revisit that later. llvm-svn: 276241
* Implement std::string_view as described in http://wg21.link/P0254R1. ↵Marshall Clow2016-07-21100-722/+19163
| | | | | | Reviewed as https://reviews.llvm.org/D21459 llvm-svn: 276238
* Mark P0358r1 as complete. It is already implementedEric Fiselier2016-07-211-1/+1
| | | | llvm-svn: 276233
* Mark P0337r0 as complete. It was already implemented in std::experimentalEric Fiselier2016-07-211-1/+1
| | | | llvm-svn: 276231
* Implement P0084r2. Changing emplace return types.Eric Fiselier2016-07-2116-111/+142
| | | | llvm-svn: 276230
* Disable warning flags when running .fail.cpp tests.Eric Fiselier2016-07-203-26/+57
| | | | | | | | | Increasingly the .fail.cpp tests are written using -verify, making them sensitive to the exact diagnostics generated by the compiler. To prevent additional diagnostics from being generated, and causing the tests to fail, this patch removes the warning flags when compiling those tests. llvm-svn: 276208
* Unbreak traits tests by handling differences between version macros in ↵Eric Fiselier2016-07-203-2/+12
| | | | | | clang/apple-clang. llvm-svn: 276200
* Fix inheriting constructor test for std::function.Eric Fiselier2016-07-201-4/+7
| | | | | | | The test I originally checked in only worked with ToT Clang. This patch updates the test so that it works as far back as 3.5. llvm-svn: 276093
* Unbreak is_constructible tests for Clang <= 3.7.Eric Fiselier2016-07-202-1/+25
| | | | | | | There is a bug in Clang's __is_constructible builtin that causes it to return true for function types; ex [T = void()]. llvm-svn: 276092
* Add missed test in r276090.Eric Fiselier2016-07-201-0/+23
| | | | llvm-svn: 276091
* Move std::function constructor SFINAE into template parameter list. Fixes ↵Eric Fiselier2016-07-201-19/+10
| | | | | | | | | PR20002. Although inheriting constructors have already been fixed in Clang 3.9 I still choose to fix std::function so users can derive from it with older compilers. llvm-svn: 276090
* Reimplement is_constructible fallback implementation. Fixes PR21574.Eric Fiselier2016-07-203-99/+108
| | | | | | | The previous implementation relied highly on specializations to handle special cases. This new implementation lets the compiler do the work when possible. llvm-svn: 276084
* Add tests for reference binding assertions in std::tuple.Eric Fiselier2016-07-203-36/+124
| | | | | | | | | | | | Libc++ provides static assertions to detect reference binding issues inside tuple. This patch adds tests for those diagnostics. It should be noted that these static assertions technically violate the standard since it allows these illegal bindings to occur. Also see https://llvm.org/bugs/show_bug.cgi?id=20855 llvm-svn: 276078
* Add SFINAE on additional overloads of std::complex functions. Fixes PR19921.Eric Fiselier2016-07-203-146/+136
| | | | | | | | | | The functions arg, conj, imag, norm, proj, and real have additional overloads for arguments of integral or floating point types. However these overloads should not allow conversions to the integral/floating point types, only exact matches. This patch constrains these functions so they no longer allow conversions. llvm-svn: 276067
* Add heterogeneous comparator support for __debug_less. Fixes PR17147.Eric Fiselier2016-07-192-1/+182
| | | | llvm-svn: 276059
* [libcxx] Add support for benchmark tests using Google Benchmark.Eric Fiselier2016-07-1973-30/+9309
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch does the following: 1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`. 2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL. 3. Allows performance benchmarks to be built as part of the libc++ build. Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target. On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries. Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions. Known Issues: * `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark. Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel Differential Revision: https://reviews.llvm.org/D22240 llvm-svn: 276049
* Fix undefined behavior in __treeEric Fiselier2016-07-198-188/+302
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch attempts to fix the undefined behavior in __tree by changing the node pointer types used throughout. The pointer types are changed for raw pointers in the current ABI and for fancy pointers in ABI V2 (since the fancy pointer types may not be ABI compatible). The UB in `__tree` arises because tree downcasts the embedded end node and then deferences that pointer. Currently there are 3 node types in __tree. * `__tree_end_node` which contains the `__left_` pointer. This node is embedded within the container. * `__tree_node_base` which contains `__right_`, `__parent_` and `__is_black`. This node is used throughout the tree rebalancing algorithms. * `__tree_node` which contains `__value_`. Currently `__tree` stores the start of the tree, `__begin_node_`, as a pointer to a `__tree_node`. Additionally the iterators store their position as a pointer to a `__tree_node`. In both of these cases the pointee can be the end node. This is fixed by changing them to store `__tree_end_node` pointers instead. To make this change I introduced an `__iter_pointer` typedef which is defined to be a pointer to either `__tree_end_node` in the new ABI or `__tree_node` in the current one. Both `__tree::__begin_node_` and iterator pointers are now stored as `__iter_pointers`. The other situation where `__tree_end_node` is stored as the wrong type is in `__tree_node_base::__parent_`. Currently `__left_`, `__right_`, and `__parent_` are all `__tree_node_base` pointers. Since the end node will only be stored in `__parent_` the fix is to change `__parent_` to be a pointer to `__tree_end_node`. To make this change I introduced a `__parent_pointer` typedef which is defined to be a pointer to either `__tree_end_node` in the new ABI or `__tree_node_base` in the current one. Note that in the new ABI `__iter_pointer` and `__parent_pointer` are the same type (but not in the old one). The confusion between these two types is unfortunate but it was the best solution I could come up with that maintains the ABI. The typedef changes force a ton of explicit type casts to correct pointer types and to make current code compatible with both the old and new pointer typedefs. This is the bulk of the change and it's really messy. Unfortunately I don't know how to avoid it. Please let me know what you think. Reviewers: howard.hinnant, mclow.lists Subscribers: howard.hinnant, bbannier, cfe-commits Differential Revision: https://reviews.llvm.org/D20786 llvm-svn: 276003
* Bump version # to 4.0.0Marshall Clow2016-07-181-1/+1
| | | | llvm-svn: 275904
* Don't use pthread initializers in constexpr constructors. Patch by elram. ↵Marshall Clow2016-07-181-5/+14
| | | | | | Reviewed at https://reviews.llvm.org/D21637. llvm-svn: 275819
* Change a couple ifdefs from '#if __cplusplus >= 2011xxx' to '#ifndef ↵Marshall Clow2016-07-183-9/+9
| | | | | | _LIBCPP_CXX03_LANG'. No functionality change. llvm-svn: 275787
* Remove locale tests that depend on enviroment variables.Eric Fiselier2016-07-181-17/+0
| | | | | | | | | | | | | | Constructing a std::locale object from an empty string selects the language from the current environment variables. If the environment variables name a locale that doesn't exist, or isn't installed, then the construction of facets using that locale may throw. This patch removes tests that use 'std::locale l("")'. The optimal solution would be to manually set the environment variables in the test. Unfortunately there is no portable way to do this. llvm-svn: 275772
* [libcxx][filesystem] Remove setgid from parent before testing permissionsJonas Hahnfeld2016-07-181-0/+3
| | | | | | | | | man page for mkdir says: "If the parent directory has the set-group-ID bit set, then so will the newly created directory." Differential Revision: https://reviews.llvm.org/D22265 llvm-svn: 275760
* Rework libatomic handling in CMake and LIT.Eric Fiselier2016-07-185-3/+9
| | | | | | | | | | | | | | | This patch updates the way libc++ handles checking for libatomic, in part to prepare for https://reviews.llvm.org/D22073. Changes: * 'LIBCXX_HAS_ATOMIC_LIB' is now set whenever libatomic is available even libc++ doesn't need to manually link it. * 'LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB' is now used to detect when libatomic needs to be manually linked. * 'LIBCXX_HAS_ATOMIC_LIB' now adds 'libatomic' as a available feature in the test suite. llvm-svn: 275759
* Improve ABI tests for std::pair.Eric Fiselier2016-07-182-5/+152
| | | | llvm-svn: 275757
* Add checkpoint diagnostics to help diagnose buildbot failures.Eric Fiselier2016-07-182-2/+11
| | | | llvm-svn: 275754
* Prevent failures by marking Clock::is_steady tests as UNSUPPORTED: asan.Eric Fiselier2016-07-183-0/+12
| | | | llvm-svn: 275753
* Add includes in test. Patch from STL@microsoft.comEric Fiselier2016-07-181-0/+4
| | | | llvm-svn: 275751
* Upgrade arcconfig to use httpsEric Fiselier2016-07-181-1/+1
| | | | llvm-svn: 275750
* Rename and rework `_LIBCPP_TRIVIAL_PAIR_COPY_CTOR`. Move FreeBSD ↵Eric Fiselier2016-07-183-24/+82
| | | | | | | | | | | | | | | | | | configuration in-tree. This patch does the following: * It renames `_LIBCPP_TRIVIAL_PAIR_COPY_CTOR` to `_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR`. * It automatically enables this option on FreeBSD in ABI V1, since that's the current ABI FreeBSD ships. * It cleans up the handling of this option in `std::pair`. I would like the sign off from the FreeBSD maintainers. They will no longer need to keep their `__config` changes downstream. I'm still hoping to come up with a better way to maintain the ABI without needing these constructors. Reviewed in https://reviews.llvm.org/D21329 llvm-svn: 275749
* Suppress warning in make_from_tuple tests.Eric Fiselier2016-07-181-0/+4
| | | | llvm-svn: 275748
* Implement C++17 tuple bits. Including apply and make_from_tuple.Eric Fiselier2016-07-189-2/+1205
| | | | | | | | | | This patch upgrades <tuple> to be C++17 compliant by implementing: * tuple_size_v: This was forgotten when implementing the other _v traits. * std::apply: This was added via LFTS v1 in p0220r1. * std::make_from_tuple: This was added in p0209r2. llvm-svn: 275745
* Check for unconstrained hash equality before constrained hash equality.Eric Fiselier2016-07-171-2/+3
| | | | | | | | | | | | | | This patch implements a simple optimization in __hash_table::find. When iterating the found bucket we only constrain the bucket elements hash if it doesn't already match the unconstrained hash of the specified key. This prevent the performance of an expensive modulo operation. Since the bucket element almost always matches the key, especially when the load factor is low, this optimization has large performance impacts. For a unordered_set<int> of random integers this patch improves the performance of 'find(...)' by 40%. llvm-svn: 275734
* Fix std::experimental::optional tests. Patch from Casey Carter.Eric Fiselier2016-07-175-13/+9
| | | | llvm-svn: 275732
* Constuct a sentry object in istream::readsome, and handle failures ↵Marshall Clow2016-07-131-11/+28
| | | | | | appropriately. Fixes PR#28217. llvm-svn: 275280
* Add more tests for LWG#2582. No code changes needed, just tests.Marshall Clow2016-07-1226-20/+48
| | | | llvm-svn: 275211
* libc++: name anonymous structsJF Bastien2016-07-121-9/+9
| | | | | | As discussed in http://reviews.llvm.org/D22073 llvm-svn: 275210
* Add tests for the meta.unary.props that do not require a complete type. This ↵Marshall Clow2016-07-124-0/+14
| | | | | | is part of LWG#2582 llvm-svn: 275184
* mark issue #2422 as complete; this was just a wording clarificationMarshall Clow2016-07-121-1/+1
| | | | llvm-svn: 275177
* mark issue #2181 as complete; this was just a wording clarificationMarshall Clow2016-07-121-1/+1
| | | | llvm-svn: 275176
* Add option to disable __deallocate #warningSaleem Abdulrasool2016-07-123-0/+10
| | | | | | | | | | | | | | From r229162: Visual Studio's SAL extension uses a macro named __deallocate. This macro is used pervasively Using -Werror when building for Windows can force the use of -Wno-#warnings specifically because of this __deallocate #warning. Instead of forcing builds to disable all #warnings, this option allows libc++ to be built without this particular warning, while leaving other #warnings enabled. Patch by Dave Lee! llvm-svn: 275172
* Put the status in the right columnMarshall Clow2016-07-121-1/+1
| | | | llvm-svn: 275171
* Mark P0067 as 'postponed', because it will be revised before the next meetingMarshall Clow2016-07-121-2/+2
| | | | llvm-svn: 275170
* Don't compute modulus of hash if it is smaller than the bucket count.Eric Fiselier2016-07-111-5/+4
| | | | | | | | This cleans up a previous optimization attempt in hash, and results in additional performance improvements over that previous attempt. Additionally this new optimization does not hinder the power of 2 bucket count optimization. llvm-svn: 275114
OpenPOWER on IntegriCloud