Skip to content

Commit b0b0072

Browse files
committed
[Clang] Add __is_invocable_r and __is_nothrow_invocable_r
This patch also uses the new builtins in libc++.
1 parent 9cc2122 commit b0b0072

File tree

7 files changed

+634
-121
lines changed

7 files changed

+634
-121
lines changed

clang/docs/LanguageExtensions.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,6 +1582,7 @@ The following type trait primitives are supported by Clang. Those traits marked
15821582
* ``__is_integral`` (C++, Embarcadero)
15831583
* ``__is_interface_class`` (Microsoft):
15841584
Returns ``false``, even for types defined with ``__interface``.
1585+
* ``__is_invocable_r`` (Clang)
15851586
* ``__is_literal`` (Clang):
15861587
Synonym for ``__is_literal_type``.
15871588
* ``__is_literal_type`` (C++, GNU, Microsoft):
@@ -1594,6 +1595,7 @@ The following type trait primitives are supported by Clang. Those traits marked
15941595
* ``__is_nothrow_assignable`` (C++, MSVC 2013)
15951596
* ``__is_nothrow_constructible`` (C++, MSVC 2013)
15961597
* ``__is_nothrow_destructible`` (C++, MSVC 2013)
1598+
* ``__is_nothrow_invocable_r`` (Clang)
15971599
* ``__is_nullptr`` (C++, GNU, Microsoft, Embarcadero):
15981600
Returns true for ``std::nullptr_t`` and false for everything else. The
15991601
corresponding standard library feature is ``std::is_null_pointer``, but

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ here. Generic improvements to Clang as a whole or to its underlying
7878
infrastructure are described first, followed by language-specific
7979
sections with improvements to Clang's support for those languages.
8080

81+
- The builtins `__is_invocable_r` and `__is_nothrow_invocable_r` have been added.
82+
These are equivalent to the standard library builtins `std::is_invocable_r`
83+
and `std::is_nothrow_invocable_r`.
84+
8185
C++ Language Changes
8286
--------------------
8387

clang/include/clang/AST/Type.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4578,6 +4578,10 @@ class FunctionProtoType final
45784578
return static_cast<RefQualifierKind>(FunctionTypeBits.RefQualifier);
45794579
}
45804580

4581+
bool isAbominable() const {
4582+
return !getMethodQuals().empty() || getRefQualifier() != RQ_None;
4583+
}
4584+
45814585
using param_type_iterator = const QualType *;
45824586

45834587
ArrayRef<QualType> param_types() const {

clang/include/clang/Basic/TokenKinds.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,8 @@ TYPE_TRAIT_1(__is_unbounded_array, IsUnboundedArray, KEYCXX)
532532
TYPE_TRAIT_1(__is_nullptr, IsNullPointer, KEYCXX)
533533
TYPE_TRAIT_1(__is_scoped_enum, IsScopedEnum, KEYCXX)
534534
TYPE_TRAIT_1(__is_referenceable, IsReferenceable, KEYCXX)
535+
TYPE_TRAIT_N(__is_invocable_r, IsInvocableR, KEYCXX)
536+
TYPE_TRAIT_N(__is_nothrow_invocable_r, IsNothrowInvocableR, KEYCXX)
535537
TYPE_TRAIT_1(__can_pass_in_regs, CanPassInRegs, KEYCXX)
536538
TYPE_TRAIT_2(__reference_binds_to_temporary, ReferenceBindsToTemporary, KEYCXX)
537539
TYPE_TRAIT_2(__reference_constructs_from_temporary, ReferenceConstructsFromTemporary, KEYCXX)

0 commit comments

Comments
 (0)