Author: Zachary Henkel Date: 2022-08-13T22:54:52+03:00 New Revision: 64f0f7e6460019a38fe2f1cbe4b9446a3268af18
URL: https://github.com/llvm/llvm-project/commit/64f0f7e6460019a38fe2f1cbe4b9446a3268af18 DIFF: https://github.com/llvm/llvm-project/commit/64f0f7e6460019a38fe2f1cbe4b9446a3268af18.diff LOG: __has_trivial_copy should map to __is_trivially_copyable Found during clang 15 RC1 testing due to the new diagnostic added by @royjacobson since clang 14. Uncertain if this fix meets the bar to also be applied to the release branch. If accepted, I'll need someone with commit access to submit on my behalf. Reviewed By: royjacobson, aaron.ballman, erichkeane Differential Revision: https://reviews.llvm.org/D131730 Added: Modified: clang/docs/LanguageExtensions.rst clang/lib/Sema/SemaExprCXX.cpp clang/test/SemaCXX/deprecated-builtins.cpp Removed: ################################################################################ diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index 3adf0a12fc4c3..0e8028d2cc066 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -1373,7 +1373,7 @@ The following type trait primitives are supported by Clang. Those traits marked * ``__has_trivial_move_assign`` (GNU, Microsoft): Deprecated, use ``__is_trivially_assignable`` instead. * ``__has_trivial_copy`` (GNU, Microsoft): - Deprecated, use ``__is_trivially_constructible`` instead. + Deprecated, use ``__is_trivially_copyable`` instead. * ``__has_trivial_constructor`` (GNU, Microsoft): Deprecated, use ``__is_trivially_constructible`` instead. * ``__has_trivial_move_constructor`` (GNU, Microsoft): diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index e3e2df03a5025..c43c9dc21bd5e 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -5412,6 +5412,8 @@ void DiagnoseBuiltinDeprecation(Sema& S, TypeTrait Kind, Replacement = BTT_IsTriviallyAssignable; break; case UTT_HasTrivialCopy: + Replacement = UTT_IsTriviallyCopyable; + break; case UTT_HasTrivialDefaultConstructor: case UTT_HasTrivialMoveConstructor: Replacement = TT_IsTriviallyConstructible; diff --git a/clang/test/SemaCXX/deprecated-builtins.cpp b/clang/test/SemaCXX/deprecated-builtins.cpp index 2bb687c1ef129..849b9b014fff2 100644 --- a/clang/test/SemaCXX/deprecated-builtins.cpp +++ b/clang/test/SemaCXX/deprecated-builtins.cpp @@ -11,7 +11,7 @@ void f() { a = __has_nothrow_constructor(A); // expected-warning-re {{__has_nothrow_constructor {{.*}} use __is_nothrow_constructible}} a = __has_trivial_assign(A); // expected-warning-re {{__has_trivial_assign {{.*}} use __is_trivially_assignable}} a = __has_trivial_move_assign(A); // expected-warning-re {{__has_trivial_move_assign {{.*}} use __is_trivially_assignable}} - a = __has_trivial_copy(A); // expected-warning-re {{__has_trivial_copy {{.*}} use __is_trivially_constructible}} + a = __has_trivial_copy(A); // expected-warning-re {{__has_trivial_copy {{.*}} use __is_trivially_copyable}} a = __has_trivial_constructor(A); // expected-warning-re {{__has_trivial_constructor {{.*}} use __is_trivially_constructible}} a = __has_trivial_move_constructor(A); // expected-warning-re {{__has_trivial_move_constructor {{.*}} use __is_trivially_constructible}} a = __has_trivial_destructor(A); // expected-warning-re {{__has_trivial_destructor {{.*}} use __is_trivially_destructible}} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits