Skip to content

Commit 3be2249

Browse files
committed
[Clang] Remove __is_referenceable builtin
1 parent 6affc18 commit 3be2249

File tree

7 files changed

+7
-45
lines changed

7 files changed

+7
-45
lines changed

clang/docs/LanguageExtensions.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,10 +1694,6 @@ The following type trait primitives are supported by Clang. Those traits marked
16941694
* ``__is_pointer_interconvertible_base_of`` (C++, GNU, Microsoft)
16951695
* ``__is_polymorphic`` (C++, GNU, Microsoft, Embarcadero)
16961696
* ``__is_reference`` (C++, Embarcadero)
1697-
* ``__is_referenceable`` (C++, GNU, Microsoft, Embarcadero):
1698-
Returns true if a type is referenceable, and false otherwise. A referenceable
1699-
type is a type that's either an object type, a reference type, or an unqualified
1700-
function type.
17011697
* ``__is_rvalue_reference`` (C++, Embarcadero)
17021698
* ``__is_same`` (C++, Embarcadero)
17031699
* ``__is_same_as`` (GCC): Synonym for ``__is_same``.

clang/docs/ReleaseNotes.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ C++ Specific Potentially Breaking Changes
9393
few users and can be written as ``__is_same(__remove_cv(T), decltype(nullptr))``,
9494
which GCC supports as well.
9595

96+
- The type trait builtin ``__is_referenceable`` has been removed, since it has
97+
very few users and all the type traits that could benefit from it in the
98+
standard library already have their own bespoke builtins.
99+
96100
- Clang will now correctly diagnose as ill-formed a constant expression where an
97101
enum without a fixed underlying type is set to a value outside the range of
98102
the enumeration's values.
@@ -310,7 +314,7 @@ C++23 Feature Support
310314

311315
- Extend lifetime of temporaries in mem-default-init for P2718R0. Clang now fully
312316
supports `P2718R0 Lifetime extension in range-based for loops <https://wg21.link/P2718R0>`_.
313-
317+
314318
- ``__cpp_explicit_this_parameter`` is now defined. (#GH82780)
315319

316320
C++20 Feature Support
@@ -717,7 +721,7 @@ Improvements to Clang's diagnostics
717721

718722
- Clang now diagnoses dangling references for C++20's parenthesized aggregate initialization (#101957).
719723

720-
- Fixed a bug where Clang would not emit ``-Wunused-private-field`` warnings when an unrelated class
724+
- Fixed a bug where Clang would not emit ``-Wunused-private-field`` warnings when an unrelated class
721725
defined a defaulted comparison operator (#GH116270).
722726

723727
.. code-block:: c++
@@ -936,7 +940,7 @@ Bug Fixes to C++ Support
936940
- Fixed an assertion failure caused by invalid default argument substitutions in non-defining
937941
friend declarations. (#GH113324)
938942
- Fix a crash caused by incorrect argument position in merging deduced template arguments. (#GH113659)
939-
- Fixed a parser crash when using pack indexing as a nested name specifier. (#GH119072)
943+
- Fixed a parser crash when using pack indexing as a nested name specifier. (#GH119072)
940944
- Fixed a null pointer dereference issue when heuristically computing ``sizeof...(pack)`` expressions. (#GH81436)
941945
- Fixed an assertion failure caused by mangled names with invalid identifiers. (#GH112205)
942946
- Fixed an incorrect lambda scope of generic lambdas that caused Clang to crash when computing potential lambda

clang/include/clang/Basic/TokenKinds.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,6 @@ TYPE_TRAIT_1(__is_trivially_equality_comparable, IsTriviallyEqualityComparable,
546546
TYPE_TRAIT_1(__is_bounded_array, IsBoundedArray, KEYCXX)
547547
TYPE_TRAIT_1(__is_unbounded_array, IsUnboundedArray, KEYCXX)
548548
TYPE_TRAIT_1(__is_scoped_enum, IsScopedEnum, KEYCXX)
549-
TYPE_TRAIT_1(__is_referenceable, IsReferenceable, KEYCXX)
550549
TYPE_TRAIT_1(__can_pass_in_regs, CanPassInRegs, KEYCXX)
551550
TYPE_TRAIT_2(__reference_binds_to_temporary, ReferenceBindsToTemporary, KEYCXX)
552551
TYPE_TRAIT_2(__reference_constructs_from_temporary, ReferenceConstructsFromTemporary, KEYCXX)

clang/lib/Parse/ParseDeclCXX.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,6 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
18131813
tok::kw___is_pointer,
18141814
tok::kw___is_polymorphic,
18151815
tok::kw___is_reference,
1816-
tok::kw___is_referenceable,
18171816
tok::kw___is_rvalue_expr,
18181817
tok::kw___is_rvalue_reference,
18191818
tok::kw___is_same,

clang/lib/Parse/ParseExpr.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,6 @@ bool Parser::isRevertibleTypeTrait(const IdentifierInfo *II,
805805
REVERTIBLE_TYPE_TRAIT(__is_pointer);
806806
REVERTIBLE_TYPE_TRAIT(__is_polymorphic);
807807
REVERTIBLE_TYPE_TRAIT(__is_reference);
808-
REVERTIBLE_TYPE_TRAIT(__is_referenceable);
809808
REVERTIBLE_TYPE_TRAIT(__is_rvalue_expr);
810809
REVERTIBLE_TYPE_TRAIT(__is_rvalue_reference);
811810
REVERTIBLE_TYPE_TRAIT(__is_same);

clang/lib/Sema/SemaExprCXX.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5032,7 +5032,6 @@ static bool CheckUnaryTypeTraitTypeCompleteness(Sema &S, TypeTrait UTT,
50325032
case UTT_IsArray:
50335033
case UTT_IsBoundedArray:
50345034
case UTT_IsPointer:
5035-
case UTT_IsReferenceable:
50365035
case UTT_IsLvalueReference:
50375036
case UTT_IsRvalueReference:
50385037
case UTT_IsMemberFunctionPointer:
@@ -5679,8 +5678,6 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT,
56795678
return T.isTriviallyRelocatableType(C);
56805679
case UTT_IsBitwiseCloneable:
56815680
return T.isBitwiseCloneableType(C);
5682-
case UTT_IsReferenceable:
5683-
return T.isReferenceable();
56845681
case UTT_CanPassInRegs:
56855682
if (CXXRecordDecl *RD = T->getAsCXXRecordDecl(); RD && !T.hasQualifiers())
56865683
return RD->canPassInRegisters();

clang/test/SemaCXX/type-traits.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -779,36 +779,6 @@ void is_unbounded_array(int n) {
779779
(void)__is_unbounded_array(decltype(t32)); // expected-error{{variable length arrays are not supported in '__is_unbounded_array'}}
780780
}
781781

782-
void is_referenceable() {
783-
static_assert(__is_referenceable(int));
784-
static_assert(__is_referenceable(const int));
785-
static_assert(__is_referenceable(volatile int));
786-
static_assert(__is_referenceable(const volatile int));
787-
static_assert(__is_referenceable(int *));
788-
static_assert(__is_referenceable(int &));
789-
static_assert(__is_referenceable(int &&));
790-
static_assert(__is_referenceable(int (*)()));
791-
static_assert(__is_referenceable(int (&)()));
792-
static_assert(__is_referenceable(int(&&)()));
793-
static_assert(__is_referenceable(IntAr));
794-
static_assert(__is_referenceable(IntArNB));
795-
static_assert(__is_referenceable(decltype(nullptr)));
796-
static_assert(__is_referenceable(Empty));
797-
static_assert(__is_referenceable(Union));
798-
static_assert(__is_referenceable(Derives));
799-
static_assert(__is_referenceable(Enum));
800-
static_assert(__is_referenceable(EnumClass));
801-
static_assert(__is_referenceable(int Empty::*));
802-
static_assert(__is_referenceable(int(Empty::*)()));
803-
static_assert(__is_referenceable(AnIncompleteType));
804-
static_assert(__is_referenceable(struct AnIncompleteType));
805-
806-
using function_type = void(int);
807-
static_assert(__is_referenceable(function_type));
808-
809-
static_assert(!__is_referenceable(void));
810-
}
811-
812782
template <typename T> void tmpl_func(T&) {}
813783

814784
template <typename T> struct type_wrapper {
@@ -4739,8 +4709,6 @@ struct CheckAbominableFunction<M S::*> {
47394709
static_assert(__is_same(remove_cvref_t<M>, M));
47404710
static_assert(__is_same(remove_pointer_t<M>, M));
47414711
static_assert(__is_same(remove_reference_t<M>, M));
4742-
4743-
static_assert(!__is_referenceable(M));
47444712
}
47454713
};
47464714

0 commit comments

Comments
 (0)