- 
                Notifications
    You must be signed in to change notification settings 
- Fork 15k
[libc++] Implement C++20 atomic_ref #76647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            99 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      f173470
              
                [libc++][atomic_ref] Refactor atomic_base_impl class and friends
              
              
                dalg24 3d8d9db
              
                [libc++][atomic_ref] Enable atomic load/exchange for non-default cons…
              
              
                dalg24 f05a599
              
                [libc++][atomic_ref] Add _LIBCPP_CHECK_WAIT_MEMORY_ORDER macro
              
              
                dalg24 6e01477
              
                [libc++][atomic_ref] Implement C++20 atomic_ref
              
              
                dalg24 1575d41
              
                [libc++][atomic_ref] Add tests for atomic_ref
              
              
                dalg24 2767cf0
              
                [libc++][atomic_ref] Fix shadow warning
              
              
                dalg24 d79c427
              
                [libc++][atomic_ref] Revert all changes to __atomic/cxx_atomic_impl.h
              
              
                dalg24 722217b
              
                [libc++][atomic_ref] move __to_gcc_[failure_]order to its own header …
              
              
                dalg24 1a0463f
              
                [libc++][atomic_ref] Reimplement atomic_ref in terms of the GCC __ato…
              
              
                dalg24 5e5a5cd
              
                [libc++][atomic_ref] add header to module map
              
              
                dalg24 d5525ad
              
                [libc++][atomic_ref] fixup atomic_{add,sub} for floating points
              
              
                dalg24 a974df0
              
                [libc++][atomic_ref] cleanup header includes
              
              
                dalg24 4172781
              
                [libc++][atomic_ref] annotate wait, notify_one, and notify_all as exp…
              
              
                dalg24 02220ba
              
                [libc++][atomic_ref] fix generic-modules build
              
              
                dalg24 8cc91fb
              
                [libc++][atomic_ref] uncomment `using std::atomic_ref;` in atomic module
              
              
                dalg24 28e4f55
              
                [libc++][atomic_ref] add missing header include for uintptr_t caught …
              
              
                dalg24 0391ec0
              
                [libc++][atomic_ref] Attempt to use __cxx_atomic_wait
              
              
                dalg24 82fcdad
              
                [libc++][atomic_ref] Fiddle with hardening-mode annotations in precon…
              
              
                dalg24 4fec87c
              
                [libc++][atomic_ref] Fix cxx03 CI build
              
              
                dalg24 f763a3a
              
                Revert "[libc++][atomic_ref] Fiddle with hardening-mode annotations i…
              
              
                dalg24 259afbf
              
                [libc++][atomic_ref] Robust against ADL lookup
              
              
                dalg24 f0cbfec
              
                [libc++][atomic_ref] Qualify all __to_gcc_order calls
              
              
                dalg24 46ab572
              
                [libc++][atomic_ref] Simplify inheritance from __atomic_ref_base
              
              
                dalg24 f9edc9f
              
                [libc++][atomic_ref] Prefer snake_case
              
              
                dalg24 2438001
              
                [libc++][atomic_ref] Use proper _LIBCPP_ASSERT_* macro
              
              
                dalg24 255559f
              
                [libc++][atomic_ref] Prefix assertion messages with "atomic_ref:"
              
              
                dalg24 8ebfe2d
              
                [libc++][atomic_ref] Fix XFAIL annotations
              
              
                dalg24 a745599
              
                [libc++][atomic_ref] Fixup conversion test
              
              
                dalg24 07ecf37
              
                [libc++][atomic_ref] Drop test that the ctor is explicit since there …
              
              
                dalg24 ba4ec71
              
                [libc++][atomic_ref] Fixup do not use -Wno-ctad-maybe-unsupported in …
              
              
                dalg24 b476c80
              
                [libc++][atomic_ref] Rename {type -> requires-trivially-copyable}.ver…
              
              
                dalg24 21bf066
              
                [libc++][atomic_ref] Const the atomic_refs in the tests
              
              
                dalg24 6df2fa8
              
                [libc++][atomic_ref] Let required_alignement test check both at runti…
              
              
                dalg24 05dad2c
              
                [libc++][atomic_ref] Add a release note and update the status page
              
              
                dalg24 991ccb6
              
                [libc++][atomic_ref] Update generated files
              
              
                dalg24 bd870b0
              
                [libc++][atomic_ref] Fix clang-tidy warnings modernize-use-nullptr
              
              
                dalg24 c10501c
              
                [libc++][atomic_ref] Use std::same_as<T> trick
              
              
                dalg24 6d310d8
              
                [libc++][atomic_ref] Forgot to update assertion msg in tests
              
              
                dalg24 7d8a1c8
              
                [libc++][atomic_ref] Fix test compare_exchange_{strong,weak} assertio…
              
              
                dalg24 89424db
              
                [libc++][atomic_ref] Forgot to use addressof in __atomic_ref_base con…
              
              
                dalg24 956f4b3
              
                [libc++][atomic_ref] Prepare the code for clearing padding bits
              
              
                dalg24 6d5c9de
              
                [libc++][atomic_ref] Include missing <cstring> header for memcmp and …
              
              
                dalg24 8ad10b6
              
                [libc++][atomic_ref] Avoid sneaky casting `T x(T(1))``
              
              
                dalg24 ee7cb80
              
                [libc++][atomic_ref] Check more types for is_always_lock_free
              
              
                dalg24 6ef3362
              
                [libc++][atomic_ref] Use fake minimally aligned pointer in is_lock_fr…
              
              
                dalg24 ed91c8c
              
                [libc++][atomic_ref] Fixup unsupported hardening mode fast
              
              
                dalg24 dee15ac
              
                [libc++][atomic_ref] revert hack to be able to use atomic wait implem…
              
              
                dalg24 79876f0
              
                Merge branch 'main' of https://github.com/llvm/llvm-project into atom…
              
              
                dalg24 5c0c3c9
              
                [libc++][atomic_ref] Use __atomic_wait following Hui's refactor
              
              
                dalg24 a795159
              
                Merge branch 'main' of https://github.com/llvm/llvm-project into atom…
              
              
                dalg24 54220e5
              
                [libc++][atomic_ref] Suppress clang-tidy diagnostic when __builtin_cl…
              
              
                dalg24 c185cfd
              
                [libc++][atomic_ref] Remove stray semicolon
              
              
                dalg24 55ee31a
              
                [libc++][atomic_ref] Mark P0019 as "Complete"
              
              
                dalg24 bc5a5df
              
                [libc++][atomic_ref] Per review put typedefs together
              
              
                dalg24 4616b46
              
                [libc++][atomic_ref] Fixup release note
              
              
                dalg24 fe1027c
              
                [libc++][atomic_ref] Propose new is_[always_]lock_free implementation…
              
              
                dalg24 e2b1529
              
                [libc++][atomic_ref] GCC does not provide __builtin_align_up
              
              
                dalg24 d935cb4
              
                [libc++][atomic_ref] Prefer reinterpret_cast to C-style cast and qual…
              
              
                dalg24 dabe768
              
                [libc++][atomic_ref] Add comment suggested by Louis to describe how t…
              
              
                dalg24 3ec8d68
              
                [libc++][atomic_ref] Use protected access specifier in __atomic_ref_base
              
              
                dalg24 54b6230
              
                [libc++][atomic_ref] Specify release in cxx20 status table
              
              
                dalg24 8a29a08
              
                [libc++][atomic_ref] __clear_padding and __compare_exchange can be pr…
              
              
                dalg24 e2e4c6c
              
                [libc++][atomic_ref] Prefer std::byte for raw memory buffers
              
              
                dalg24 becd644
              
                Merge branch 'main' of https://github.com/llvm/llvm-project into atom…
              
              
                dalg24 4d7c3a8
              
                [libc++][atomic_ref] Instantiate tests for more types
              
              
                dalg24 e4da1e0
              
                [libc++][atomic_ref] Instantiate libcxx tests for more types
              
              
                dalg24 e09ac7a
              
                [libc++][atomic_ref] assert integral type
              
              
                dalg24 cee65ac
              
                [libc++][atomic_ref] casually disable long double tests that failed
              
              
                dalg24 7e68d6c
              
                [libc++][atomic_ref] assert integral type in xor
              
              
                dalg24 3cc65a5
              
                [libc++][atomic_ref] forgot fetch_sub
              
              
                dalg24 f64b44f
              
                [libc++][atomic_ref] Add tests that actually check the aromicity
              
              
                dalg24 64941f1
              
                Merge branch 'main' of https://github.com/llvm/llvm-project into atom…
              
              
                dalg24 8101aff
              
                [libc++][atomic_ref] delete trailing empty line in test helper that c…
              
              
                dalg24 ef5fb5a
              
                [libc++][atomic_ref] fix redeclaration of x shadow warning
              
              
                dalg24 e656ca2
              
                Merge branch 'main' of https://github.com/llvm/llvm-project into atom…
              
              
                dalg24 9c20e50
              
                Merge branch 'main' of https://github.com/llvm/llvm-project into atom…
              
              
                dalg24 919e8c9
              
                [libc++][atomic_ref] Mark notify_{all,one}/wait test as unsupported w…
              
              
                dalg24 cce18df
              
                Merge branch 'main' of https://github.com/llvm/llvm-project into atom…
              
              
                dalg24 6815d2b
              
                [libc++][atomic_ref] Fixup AtomicRef status entry
              
              
                dalg24 049b3d7
              
                [libc++][atomic_ref] Also mark P1643R1 (add wait/notify to atomic_ref…
              
              
                dalg24 505ddb5
              
                [libc++][atomic_ref] Add empty line before the first REQUIRES
              
              
                dalg24 a593fa0
              
                [libc++][atomic_ref] Add comment where no assertion is expected to fail
              
              
                dalg24 0a03362
              
                [libc++][atomic_ref] Prefer TestEachAtomicType
              
              
                dalg24 41b1eff
              
                [libc++][atomic_ref] Improve misaligned objects test
              
              
                dalg24 4279d70
              
                [libc++][atomic_ref] Add a comment for the definition of is_always_lo…
              
              
                dalg24 12ecd1d
              
                [libc++][atomic_ref] Fix typo memory_or[e]der
              
              
                dalg24 d7ff8c9
              
                [libc++][atomic_ref] Inline test() into main and use TestEachAtomicType
              
              
                dalg24 7492f36
              
                [libc++][atomic_ref] check return type with same_as decltype(auto) idiom
              
              
                dalg24 3d6645b
              
                [libc++][atomic_ref] improve operator&= test
              
              
                dalg24 75d3a66
              
                [libc++][atomic_ref] Fix typo in noexecpt check for operator|=
              
              
                dalg24 9b81d05
              
                [libc++][atomic_ref] Add missing <concepts> header include
              
              
                dalg24 6ae8d85
              
                [libc++][atomic_ref] Fix shadowed declaration warning
              
              
                dalg24 8fef446
              
                [libc++][atomic_ref] Fix silly redefinition of a buffer of raw unitia…
              
              
                dalg24 856d2dd
              
                [libc++][atomic_ref] Add XFAIL: !has-64-bit-atomics
              
              
                dalg24 e39d261
              
                [libc++][atomic_ref] Add XFAIL: !has-64-bit-atomics and XFAIL: availa…
              
              
                dalg24 ee8a50e
              
                [libc++][atomic_ref] Fixup fetch_{add,sub} do not use TestEachFloatin…
              
              
                dalg24 47d3cde
              
                [libc++][atomic_ref] Add XFAIL: !has-1024-bit-atomics to "fix" the wi…
              
              
                dalg24 9c85f18
              
                [libc++][atomic_ref] Attempt to drop XFAIL: !has-64-bit-atomics in a …
              
              
                dalg24 233f568
              
                Merge branch 'main' into atomic_ref
              
              
                dalg24 File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              Large diffs are not rendered by default.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|  | ||
| #ifndef _LIBCPP___ATOMIC_TO_GCC_ORDER_H | ||
| #define _LIBCPP___ATOMIC_TO_GCC_ORDER_H | ||
|  | ||
| #include <__atomic/memory_order.h> | ||
| #include <__config> | ||
|  | ||
| #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| # pragma GCC system_header | ||
| #endif | ||
|  | ||
| _LIBCPP_BEGIN_NAMESPACE_STD | ||
|  | ||
| #if defined(__ATOMIC_RELAXED) && defined(__ATOMIC_CONSUME) && defined(__ATOMIC_ACQUIRE) && \ | ||
| defined(__ATOMIC_RELEASE) && defined(__ATOMIC_ACQ_REL) && defined(__ATOMIC_SEQ_CST) | ||
|  | ||
| _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) { | ||
| // Avoid switch statement to make this a constexpr. | ||
| return __order == memory_order_relaxed | ||
| ? __ATOMIC_RELAXED | ||
| : (__order == memory_order_acquire | ||
| ? __ATOMIC_ACQUIRE | ||
| : (__order == memory_order_release | ||
| ? __ATOMIC_RELEASE | ||
| : (__order == memory_order_seq_cst | ||
| ? __ATOMIC_SEQ_CST | ||
| : (__order == memory_order_acq_rel ? __ATOMIC_ACQ_REL : __ATOMIC_CONSUME)))); | ||
| } | ||
|  | ||
| _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) { | ||
| // Avoid switch statement to make this a constexpr. | ||
| return __order == memory_order_relaxed | ||
| ? __ATOMIC_RELAXED | ||
| : (__order == memory_order_acquire | ||
| ? __ATOMIC_ACQUIRE | ||
| : (__order == memory_order_release | ||
| ? __ATOMIC_RELAXED | ||
| : (__order == memory_order_seq_cst | ||
| ? __ATOMIC_SEQ_CST | ||
| : (__order == memory_order_acq_rel ? __ATOMIC_ACQUIRE : __ATOMIC_CONSUME)))); | ||
| } | ||
|  | ||
| #endif | ||
|  | ||
| _LIBCPP_END_NAMESPACE_STD | ||
|  | ||
| #endif // _LIBCPP___ATOMIC_TO_GCC_ORDER_H | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.