summaryrefslogtreecommitdiffstats
path: root/libcxx/include
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement Pp0156r2: 'Variadic Lock Guard, version 5' Reviewed as ↵Marshall Clow2017-03-244-38/+53
| | | | | | https://reviews.llvm.org/D31163. llvm-svn: 298681
* [libcxx] Improve code generation for vector::clear().Bruce Mitchener2017-03-231-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: By manipulating a local variable in the loop, when the loop can be optimized away (due to no non-trivial destructors), this lets it be fully optimized away and we modify the __end_ separately. This results in a substantial improvement in the generated code. Prior to this change, this would be generated (on x86_64): movq (%rdi), %rdx movq 8(%rdi), %rcx cmpq %rdx, %rcx je LBB2_2 leaq -12(%rcx), %rax subq %rdx, %rax movabsq $-6148914691236517205, %rdx ## imm = 0xAAAAAAAAAAAAAAAB mulq %rdx shrq $3, %rdx notq %rdx leaq (%rdx,%rdx,2), %rax leaq (%rcx,%rax,4), %rax movq %rax, 8(%rdi) And after: movq (%rdi), %rax movq %rax, 8(%rdi) This brings this in line with what other implementations do. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25241 llvm-svn: 298601
* One more file for the random_shuffle removalMarshall Clow2017-03-231-0/+1
| | | | llvm-svn: 298598
* Remove random_shuffle in C++17. Please use shuffle instead. If you have to, ↵Marshall Clow2017-03-231-2/+4
| | | | | | you cant get it back by defining _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE before including any libc++ headers. llvm-svn: 298597
* Can't test for noexcept on C++03; std::hash<nullptr_t> isn't available until ↵Marshall Clow2017-03-231-0/+1
| | | | | | C++17 llvm-svn: 298580
* Implement P0599: 'noexcept for hash functions'. Fix a couple of hash ↵Marshall Clow2017-03-234-4/+4
| | | | | | functions (optional<T> and unique_ptr<T>) which were mistakenly marked as 'noexcept'. Reviewed as https://reviews.llvm.org/D31234 llvm-svn: 298573
* Fix test failure I introducedMarshall Clow2017-03-211-6/+6
| | | | llvm-svn: 298438
* Fix a couple of 'C++11'-isms from the last checkin, which broke the '03 bot.Marshall Clow2017-03-211-0/+7
| | | | llvm-svn: 298422
* Implement P0548: 'common_type and duration' This involves a subtle change in ↵Marshall Clow2017-03-212-8/+8
| | | | | | the return type of the unary +/- operators for std::chrono::duration, though I expect that no one will notice. llvm-svn: 298416
* Implement LWG#2761: 'basic_string should require that charT match ↵Marshall Clow2017-03-152-2/+6
| | | | | | traits::char_type'. Tests for string_view, too llvm-svn: 297872
* Implement LWG2784, and mark 2786, 2795, 2804, 2812, 2826, 2834, 2837 and ↵Marshall Clow2017-03-141-6/+10
| | | | | | 2838 as complete - since we do them already llvm-svn: 297752
* Disable unsigned integer sanitizer for basic_string::replace(). Patch from ↵Eric Fiselier2017-03-091-0/+4
| | | | | | | | | | | | | | | | | | tomcherry@google.com basic_string::replace() has the below line __sz += __n2 - __n1; which fails overflow checks if __n1 > __n2, as the negative result from the subtraction then overflows the original __sz when added to it. This behavior is valid as unsigned integer overflow is defined to wrap around the maximum value and that produces the correct final value for __sz. Therefore, we disable this check on this function. llvm-svn: 297355
* [libc++] Avoid double defining macro on WindowsShoaib Meenai2017-03-091-0/+6
| | | | | | | | Put proper guards around _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS. No functional change on non-Windows. Avoids incorrect macro redefinition on Windows. llvm-svn: 297330
* Implement LWG 2787 - [file_status.cons] is inconsistentEric Fiselier2017-03-061-2/+4
| | | | llvm-svn: 297071
* Fix hash requirements check in __hash_table.Eric Fiselier2017-03-032-7/+11
| | | | | | | | | | | | | | r296565 attempted to add better diagnostics when an unordered container is instantiated with a hash that doesn't meet the Hash requirements. However I mistakenly checked the wrong set of requirements. Specifically it checked if the hash met the requirements for specializations of std::hash. However these requirements are stricter than the generic Hash requirements. This patch fixes the assertions to only check the Hash requirements. llvm-svn: 296919
* remove max_size() extension from polymorphic_allocator. It is unneededEric Fiselier2017-03-021-6/+6
| | | | llvm-svn: 296831
* [libc++] Make _LIBCPP_TYPE_VIS export membersShoaib Meenai2017-03-028-8/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Most classes annotated with _LIBCPP_TYPE_VIS need to have at least some of their members exported, otherwise we have a lot of link errors when linking against a libc++ built with hidden visibility. This also makes _LIBCPP_TYPE_VIS be consistent across platforms, since on Windows it already exports members. With this change made, any template methods of a class marked _LIBCPP_TYPE_VIS will also get default visibility when instantiatied, which is not desirable for clients of libc++ headers who wish to control their visibility; this is the same issue as PR30642. Annotate all problematic methods with an explicit visibility specifier to avoid this. The problematic methods were found by running bad-visibility-finder [1] against the libc++ headers after making the _LIBCPP_TYPE_VIS change. The small methods were marked for inlining; the larger ones hidden. [1] https://github.com/smeenai/bad-visibility-finder Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25208 llvm-svn: 296732
* [libc++] Make _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS export membersShoaib Meenai2017-03-023-16/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building libc++ with hidden visibility, we want explicit template instantiations to export members. This is consistent with existing Windows behavior, and is necessary for clients to be able to link against a hidden visibility built libc++ without running into lots of missing symbols. An unfortunate side effect, however, is that any template methods of a class with an explicit instantiation will get default visibility when instantiated, unless the methods are explicitly marked inline or hidden visibility. This is not desirable for clients of libc++ headers who wish to control their visibility, and led to PR30642. Annotate all problematic methods with an explicit visibility specifier to avoid this. The problematic methods were found by running https://github.com/smeenai/bad-visibility-finder against the libc++ headers after making the _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS change. The methods were marked with the new _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS macro, which was created for this purpose. It should be noted that _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS was originally intended to expand to default visibility, and was changed to expanding to default type visibility to fix PR30642. The visibility macro documentation was not updated accordingly, however, so this change makes the macro consistent with its documentation again, while explicitly fixing the methods which resulted in that PR. Differential Revision: https://reviews.llvm.org/D29157 llvm-svn: 296731
* [libc++] Mark some std::num_get method templates inlineShoaib Meenai2017-03-021-3/+3
| | | | | | | | | | | | | | | | | D29157 will make explicit template instantiations expand to default visibility, at which point these method templates will need to be explicitly marked hidden visibility to avoid leaking into other DSOs. Unfortunately, because of clang PR32114, they must be marked inline (in conjunction with `-fvisibility-inlines-hidden`) to actually hide them, since clang doesn't respect the hidden visibility annotation. Since this involves an ABI change, mark these methods inline in a separate change, so that the ABI changes can be reviewed separately and verified to be safe. Differential Revision: https://reviews.llvm.org/D30523 llvm-svn: 296729
* Improve diagnostics when an invalid hash is used in an unordered container.Eric Fiselier2017-03-011-7/+20
| | | | | | | | | This patch adds a static assertion that the specified hash meets the requirements of an enabled hash, and it ensures that the static assertion is evaluated before __compressed_pair is instantiated. That way the static assertion diagnostic is emitted first. llvm-svn: 296565
* Fix PR32097 - is_abstract doesn't work on class templates.Eric Fiselier2017-03-011-12/+2
| | | | | | | | | | This patch fixes llvm.org/PR32097 by using the __is_abstract builtin type-trait instead of the previous library-only implementation. All supported compilers provide this trait. I've tested as far back as Clang 3.2, GCC 4.6 and MSVC trunk. llvm-svn: 296561
* Fix LIBCXX_HAS_EXTERNAL_THREAD_API builds. NFC.Asiri Rathnayake2017-02-271-1/+2
| | | | | | Add the missing check in the __config header. llvm-svn: 296351
* Fix typo in error message. NFC.Asiri Rathnayake2017-02-271-1/+1
| | | | llvm-svn: 296346
* Revert "threading_support: make __thread_sleep_for be alertable"Saleem Abdulrasool2017-02-181-5/+3
| | | | | | | | | This reverts SVN r295329. Although `__libcpp_thread_sleep_for` should be alertable, the implementation causes a large regression in the test suite. Add a FIXME item there for now to get the test suite in a better state before attempting to fix that behaviour. llvm-svn: 295561
* math: add type promoting template definition on MSVCRTSaleem Abdulrasool2017-02-181-0/+20
| | | | | | | | When building with MSVCRT, we need to manually provide the type promoting overloads to allow the correct type deduced invocation for signbit(Int) and fpclassify(int). llvm-svn: 295559
* math: fix typo in macroSaleem Abdulrasool2017-02-172-8/+8
| | | | | | MAJOR was misspelt as NAJOR. Fix the spelling. llvm-svn: 295510
* cmath: Use c99 math on a new enough msvcrtSaleem Abdulrasool2017-02-171-4/+4
| | | | | | | MSVCRT 14+ supports the C99 math routines that we need. Use them accordingly. llvm-svn: 295509
* Update all bug URL's to point to https://bugs.llvm.org/...Eric Fiselier2017-02-171-1/+1
| | | | llvm-svn: 295434
* Use inline namespaces with GCC instead of __attribute__((__strong__)).Eric Fiselier2017-02-171-4/+3
| | | | | | | | | | | | | | GCC 7.0.1 started warning that __attribute__((__strong__)) is depricated. This patch switches to using inline namespace with GCC instead. I believe this wasn't done originally in order to support older GCC versions w/o support for inline namespaces, or because earlier versions of GCC warned users that the STL was using an inline namespace (even though it shouldn't affect users). However I believe all of the above problems are gone for GCC 4.9 and greater. Therefore switching to using inline namespaces instead of using __strong__ is the most correct behavior. llvm-svn: 295428
* Add doc for _LIBCPP_ENABLE_CXX17_DISABLED_AUTO_PTR and make it work under ↵Eric Fiselier2017-02-171-0/+1
| | | | | | _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES llvm-svn: 295407
* [libcxx] Remove unexpected handlers in C++17Eric Fiselier2017-02-172-0/+8
| | | | | | | | | | | | | | | | | | | Summary: This patch implements [P0003R5](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0003r5.html) which removes exception specifications from C++17. The only changes to the library are removing `set_unexpected`, `get_unexpected`, `unexpected`, and `unexpected_handler`. These functions can be re-enabled in C++17 using `_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS`. @mclow.lists what do you think about removing stuff is this way? Reviewers: mclow.lists Reviewed By: mclow.lists Subscribers: mclow.lists, cfe-commits Differential Revision: https://reviews.llvm.org/D28172 llvm-svn: 295406
* Mark a couple for basic_string member templates as inline. no ABI change ↵Eric Fiselier2017-02-171-3/+3
| | | | | | this time. llvm-svn: 295403
* Remove more basic_string member function templates from the dylib exportsEric Fiselier2017-02-171-8/+8
| | | | llvm-svn: 295398
* [libc++] Fix PR 31938 - std::basic_string constructors use non-deductible ↵Eric Fiselier2017-02-171-26/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parameter types. Summary: This patch fixes http://llvm.org/PR31938. The description below is copy/pasted from the bug: The standard says: template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>> class basic_string { using value_type = typename traits::char_type; // ... basic_string(const charT* s, const Allocator& a = Allocator()); }; libc++ actually chooses to declare the constructor as basic_string(const value_type* s, const Allocator& a = Allocator()); The implicit deduction guides from class template argument deduction make what was previously an implementation detail visible: std::basic_string s = "foo"; // error, can't deduce charT. The constructor in question is in the libc++ DSO, but fortunately it looks like fixing this will not result in an ABI break. @rsmith How does this look? I did more than just the constructors mentioned in the PR, but IDK how far to take it. Reviewers: mclow.lists, rsmith Reviewed By: rsmith Subscribers: cfe-commits, rsmith Differential Revision: https://reviews.llvm.org/D29863 llvm-svn: 295393
* math: correct the MSVCRT conditionSaleem Abdulrasool2017-02-162-4/+4
| | | | | | Fixes a number of tests in the testsuite on Windows. llvm-svn: 295330
* threading_support: make __thread_sleep_for be alertableSaleem Abdulrasool2017-02-161-2/+5
| | | | | | | | | | On Windows, we were using `Sleep` which is not alertable. This means that if the thread was used for a user APC or WinProc handling and thread::sleep was used, we could potentially dead lock. Use `SleepEx` with an alertable sleep, resuming until the time has expired if we are awoken early. llvm-svn: 295329
* config: disable thread safety analysis on COFFSaleem Abdulrasool2017-02-131-2/+8
| | | | | | | | clang cannot properly handle __declspec and __attribute__ on classes right now. This prevents the shared_mutex tests from working. Disable the use of the annotation on COFF targets. llvm-svn: 294958
* math: actually pull the declarations/overloads into stdSaleem Abdulrasool2017-02-132-1/+4
| | | | | | | The previous changes missed the change to include/cmath. These changes allow some of the rand.distribution tests to pass on Windows. llvm-svn: 294957
* math: follow up to SVN r294902Saleem Abdulrasool2017-02-121-26/+26
| | | | | | | | Pull in the math functions from ucrt 14+ after auditing the library. It seems that they are now complete for C99 math. Fixes more windows tests! llvm-svn: 294918
* math: pull more C functions from stdSaleem Abdulrasool2017-02-121-2/+2
| | | | | | | The newer ucrt version provides the gamma meth routines. Includede them when building the library. llvm-svn: 294902
* cmath: adjust math forwards for WindowsSaleem Abdulrasool2017-02-121-2/+2
| | | | | | | | The newer versions of ucrt have the math routines. Use the CRT version to determine if we should include the math routines. Fixes two tests for Windows. llvm-svn: 294899
* Make lcm/gcd work better in edge cases. Fixes a UBSAN failure.Marshall Clow2017-02-102-23/+33
| | | | llvm-svn: 294779
* Recommit "Split exception.cpp and new.cpp implementation into different ↵Eric Fiselier2017-02-103-8/+31
| | | | | | | | | | | | | | | | | | | | | | 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-103-30/+7
| | | | | | | | 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-103-7/+30
| | | | | | | | | | | | | | | | | | | 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
* __threading_support: fix windows buildSaleem Abdulrasool2017-02-101-1/+2
| | | | | | | | The build was broken as there was no overload for long and std::chrono::nanoseconds. Add an explicit conversion to use the operator+. llvm-svn: 294698
* Fully qualify (preprend ::) calls to math functions from libcMehdi Amini2017-02-101-170/+170
| | | | | | | | | | | | | | | | | | | | | | Summary: This can cause a compile failure in cases like: double log(double); namespace foo { namespace log {} } using namespace foo; void bar(int i) { log((double)i); } Reviewers: EricWF, mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D29804 llvm-svn: 294696
* Check for musl-libc's max_align_t in addition to other variants.David L. Jones2017-02-102-2/+4
| | | | | | | | | | | | | | | | | | Summary: Libcxx will define its own max_align_t when it is not available. However, the availability checks today only check for Clang's definition and GCC's definition. In particular, it does not check for musl's definition, which is the same as GCC's but guarded with a different macro. Reviewers: mclow.lists, EricWF Reviewed By: EricWF Subscribers: chandlerc, cfe-commits Differential Revision: https://reviews.llvm.org/D28478 llvm-svn: 294683
* Fix PR31916 - std::visit rejects visitors accepting lvalue argumentsEric Fiselier2017-02-091-1/+1
| | | | | | | | | | A static assertion was misfiring since it checked is_callable<Visitor, decltype(__variant_alt<T>.value)>. However the decltype expression doesn't capture the value category as required. This patch applies extra braces to decltype to fix that. llvm-svn: 294612
* Use protected name for the prototype arguments.Joerg Sonnenberger2017-02-092-2/+2
| | | | llvm-svn: 294585
OpenPOWER on IntegriCloud