Skip to content

[Clang] Remove __is_nullptr #99038

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 3 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions clang/docs/LanguageExtensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1614,10 +1614,6 @@ 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_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
``__is_null_pointer`` is already in use by some implementations.
* ``__is_object`` (C++, Embarcadero)
* ``__is_pod`` (C++, GNU, Microsoft, Embarcadero):
Note, the corresponding standard trait was deprecated in C++20.
Expand Down
4 changes: 4 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ C/C++ Language Potentially Breaking Changes
C++ Specific Potentially Breaking Changes
-----------------------------------------

- The type trait builtin ``__is_nullptr`` has been removed, since it has very
few users and can be written as ``__is_same(__remove_cv(T), decltype(nullptr))``,
which GCC supports as well.

ABI Changes in This Version
---------------------------

Expand Down
3 changes: 1 addition & 2 deletions clang/lib/Parse/ParseDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ Decl *Parser::ParseLinkage(ParsingDeclSpec &DS, DeclaratorContext Context) {
///
/// HLSL: Parse export function declaration.
///
/// export-function-declaration:
/// export-function-declaration:
/// 'export' function-declaration
///
/// export-declaration-group:
Expand Down Expand Up @@ -1799,7 +1799,6 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
tok::kw___is_nothrow_constructible,
tok::kw___is_nothrow_convertible,
tok::kw___is_nothrow_destructible,
tok::kw___is_nullptr,
tok::kw___is_object,
tok::kw___is_pod,
tok::kw___is_pointer,
Expand Down
1 change: 0 additions & 1 deletion clang/lib/Parse/ParseExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,6 @@ bool Parser::isRevertibleTypeTrait(const IdentifierInfo *II,
REVERTIBLE_TYPE_TRAIT(__is_nothrow_assignable);
REVERTIBLE_TYPE_TRAIT(__is_nothrow_constructible);
REVERTIBLE_TYPE_TRAIT(__is_nothrow_destructible);
REVERTIBLE_TYPE_TRAIT(__is_nullptr);
REVERTIBLE_TYPE_TRAIT(__is_object);
REVERTIBLE_TYPE_TRAIT(__is_pod);
REVERTIBLE_TYPE_TRAIT(__is_pointer);
Expand Down
3 changes: 0 additions & 3 deletions clang/lib/Sema/SemaExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4979,7 +4979,6 @@ static bool CheckUnaryTypeTraitTypeCompleteness(Sema &S, TypeTrait UTT,
case UTT_IsArray:
case UTT_IsBoundedArray:
case UTT_IsPointer:
case UTT_IsNullPointer:
case UTT_IsReferenceable:
case UTT_IsLvalueReference:
case UTT_IsRvalueReference:
Expand Down Expand Up @@ -5238,8 +5237,6 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT,
return T->isIncompleteArrayType();
case UTT_IsPointer:
return T->isAnyPointerType();
case UTT_IsNullPointer:
return T->isNullPtrType();
case UTT_IsLvalueReference:
return T->isLValueReferenceType();
case UTT_IsRvalueReference:
Expand Down
36 changes: 0 additions & 36 deletions clang/test/SemaCXX/type-traits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1041,42 +1041,6 @@ void is_pointer()
static_assert(!__is_pointer(void (StructWithMembers::*) ()));
}

void is_null_pointer() {
StructWithMembers x;

static_assert(__is_nullptr(decltype(nullptr)));
static_assert(!__is_nullptr(void *));
static_assert(!__is_nullptr(cvoid *));
static_assert(!__is_nullptr(cvoid *));
static_assert(!__is_nullptr(char *));
static_assert(!__is_nullptr(int *));
static_assert(!__is_nullptr(int **));
static_assert(!__is_nullptr(ClassType *));
static_assert(!__is_nullptr(Derives *));
static_assert(!__is_nullptr(Enum *));
static_assert(!__is_nullptr(IntArNB *));
static_assert(!__is_nullptr(Union *));
static_assert(!__is_nullptr(UnionAr *));
static_assert(!__is_nullptr(StructWithMembers *));
static_assert(!__is_nullptr(void (*)()));

static_assert(!__is_nullptr(void));
static_assert(!__is_nullptr(cvoid));
static_assert(!__is_nullptr(cvoid));
static_assert(!__is_nullptr(char));
static_assert(!__is_nullptr(int));
static_assert(!__is_nullptr(int));
static_assert(!__is_nullptr(ClassType));
static_assert(!__is_nullptr(Derives));
static_assert(!__is_nullptr(Enum));
static_assert(!__is_nullptr(IntArNB));
static_assert(!__is_nullptr(Union));
static_assert(!__is_nullptr(UnionAr));
static_assert(!__is_nullptr(StructWithMembers));
static_assert(!__is_nullptr(int StructWithMembers::*));
static_assert(!__is_nullptr(void(StructWithMembers::*)()));
}

void is_member_object_pointer()
{
StructWithMembers x;
Expand Down
Loading