diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index 81784c75081ba..cfd7d29fb9eac 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -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. diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 0b79e952b48af..afc7d0ce2edae 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -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 --------------------------- diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index ce827c689beb7..aac89d910bbc8 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -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: @@ -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, diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 0a017ae79de75..a65181f81a272 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -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); diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 14d1f395af90e..bf284cb6de8ba 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -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: @@ -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: diff --git a/clang/test/SemaCXX/type-traits.cpp b/clang/test/SemaCXX/type-traits.cpp index 23b07cac13eaf..a6c6fba7c92c9 100644 --- a/clang/test/SemaCXX/type-traits.cpp +++ b/clang/test/SemaCXX/type-traits.cpp @@ -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;