Skip to content

Commit

Permalink
[Clang] Add __is_invocable_r and __is_nothrow_invocable_r
Browse files Browse the repository at this point in the history
This patch also uses the new builtins in libc++.
  • Loading branch information
philnik777 committed Feb 10, 2024
1 parent 9cc2122 commit a6ef919
Show file tree
Hide file tree
Showing 6 changed files with 634 additions and 121 deletions.
2 changes: 2 additions & 0 deletions clang/docs/LanguageExtensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,7 @@ The following type trait primitives are supported by Clang. Those traits marked
* ``__is_integral`` (C++, Embarcadero)
* ``__is_interface_class`` (Microsoft):
Returns ``false``, even for types defined with ``__interface``.
* ``__is_invocable_r`` (Clang)
* ``__is_literal`` (Clang):
Synonym for ``__is_literal_type``.
* ``__is_literal_type`` (C++, GNU, Microsoft):
Expand All @@ -1594,6 +1595,7 @@ The following type trait primitives are supported by Clang. Those traits marked
* ``__is_nothrow_assignable`` (C++, MSVC 2013)
* ``__is_nothrow_constructible`` (C++, MSVC 2013)
* ``__is_nothrow_destructible`` (C++, MSVC 2013)
* ``__is_nothrow_invocable_r`` (Clang)
* ``__is_nullptr`` (C++, GNU, Microsoft, Embarcadero):
Returns true for ``std::nullptr_t`` and false for everything else. The
corresponding standard library feature is ``std::is_null_pointer``, but
Expand Down
4 changes: 4 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ here. Generic improvements to Clang as a whole or to its underlying
infrastructure are described first, followed by language-specific
sections with improvements to Clang's support for those languages.

- The builtins `__is_invocable_r` and `__is_nothrow_invocable_r` have been added.
These are equivalent to the standard library builtins `std::is_invocable_r`
and `std::is_nothrow_invocable_r`.

C++ Language Changes
--------------------

Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/Basic/TokenKinds.def
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,8 @@ TYPE_TRAIT_1(__is_unbounded_array, IsUnboundedArray, KEYCXX)
TYPE_TRAIT_1(__is_nullptr, IsNullPointer, KEYCXX)
TYPE_TRAIT_1(__is_scoped_enum, IsScopedEnum, KEYCXX)
TYPE_TRAIT_1(__is_referenceable, IsReferenceable, KEYCXX)
TYPE_TRAIT_N(__is_invocable_r, IsInvocableR, KEYCXX)
TYPE_TRAIT_N(__is_nothrow_invocable_r, IsNothrowInvocableR, KEYCXX)
TYPE_TRAIT_1(__can_pass_in_regs, CanPassInRegs, KEYCXX)
TYPE_TRAIT_2(__reference_binds_to_temporary, ReferenceBindsToTemporary, KEYCXX)
TYPE_TRAIT_2(__reference_constructs_from_temporary, ReferenceConstructsFromTemporary, KEYCXX)
Expand Down
Loading

0 comments on commit a6ef919

Please sign in to comment.