-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Sema] Add deprecation warnings for some compiler provided __has_* ty…
…pe traits Some compiler provided type traits like __has_trivial_constructor have been documented as deprecated for quite some time. Still, some people apparently still use them, even though mixing them with concepts and with deleted functions leads to weird results. There's also disagreement about some edge cases between GCC (which Clang claims to follow) and MSVC. This patch adds deprecation warnings for the usage of those builtins, except for __has_trivial_destructor which doesn't have a GCC alternative. I made the warning on by default, so I had to silence it for some tests but it's not too many. Some (decade old) history of issues with those builtins: #18187 #18559 #22161 #33063 The abseil usage of them that triggered me to add this warning: abseil/abseil-cpp#1201 Weird interaction of those builtins with C++20's conditionally trivial special member functions: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106085 Reviewed By: #clang-language-wg, aaron.ballman Differential Revision: https://reviews.llvm.org/D129170
- Loading branch information
1 parent
2240d72
commit 0b89d1d
Showing
20 changed files
with
95 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -verify %s | ||
|
||
struct A {}; | ||
|
||
void f() { | ||
bool a; | ||
|
||
a = __has_nothrow_assign(A); // expected-warning-re {{__has_nothrow_assign {{.*}} use __is_nothrow_assignable}} | ||
a = __has_nothrow_move_assign(A); // expected-warning-re {{__has_nothrow_move_assign {{.*}} use __is_nothrow_assignable}} | ||
a = __has_nothrow_copy(A); // expected-warning-re {{__has_nothrow_copy {{.*}} use __is_nothrow_constructible}} | ||
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_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}} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters