[PATCH] D148677: [clang] makes `__is_trivially_equality_comparable` available as a struct

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 18 18:01:17 PDT 2023


cjdb created this revision.
cjdb added reviewers: aaron.ballman, erichkeane, shafik, dblaikie.
Herald added a project: All.
cjdb requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Since this was originally a name in library, it needs an escape hatch
for versions of Clang that are slightly out-of-sync with libc++.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148677

Files:
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/test/SemaCXX/move-not-noexcept.cpp


Index: clang/test/SemaCXX/move-not-noexcept.cpp
===================================================================
--- /dev/null
+++ clang/test/SemaCXX/move-not-noexcept.cpp
@@ -0,0 +1,63 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+struct TrivialMoveOps {};
+
+struct DefaultedMoveCtor {
+  DefaultedMoveCtor(DefaultedMoveCtor&&) = default;
+};
+
+struct DefaultedMoveAssign {
+  DefaultedMoveAssign& operator=(DefaultedMoveAssign&&) = default;
+};
+
+struct UnknownNoexceptCtor {
+  UnknownNoexceptCtor(UnknownNoexceptCtor&&);
+  // expected-warning at -1{{move constructor for 'UnknownNoexceptCtor' is not noexcept, which can cause performance issues; use 'noexcept(false)' if this is intentional}}
+};
+
+struct UnknownNoexceptAssign {
+  UnknownNoexceptAssign& operator=(UnknownNoexceptAssign&&);
+  // expected-warning at -1{{move assignment operator for 'UnknownNoexceptAssign' is not noexcept, which can cause performance issues; use 'noexcept(false)' if this is intentional}}
+};
+
+struct NoexceptSpecifierCtor {
+  NoexceptSpecifierCtor(NoexceptSpecifierCtor&&) noexcept;
+};
+
+struct NoexceptSpecifierAssign {
+  NoexceptSpecifierAssign& operator=(NoexceptSpecifierAssign&&) noexcept;
+};
+
+struct NoexceptTrueSpecifierCtor {
+  NoexceptTrueSpecifierCtor(NoexceptTrueSpecifierCtor&&) noexcept(true);
+};
+
+struct NoexceptTrueSpecifierAssign {
+  NoexceptTrueSpecifierAssign& operator=(NoexceptTrueSpecifierAssign&&) noexcept(true);
+};
+
+struct NoexceptFalseSpecifierCtor {
+  NoexceptFalseSpecifierCtor(NoexceptFalseSpecifierCtor&&) noexcept(false);
+};
+
+struct NoexceptFalseSpecifierAssign {
+  NoexceptFalseSpecifierAssign& operator=(NoexceptFalseSpecifierAssign&&) noexcept(false);
+};
+
+template<class T>
+struct NoexceptDependentSpecifierCtor {
+  NoexceptDependentSpecifierCtor(NoexceptDependentSpecifierCtor&&) noexcept(__is_integral(T));
+};
+
+template<class T>
+struct NoexceptDependentSpecifierAssign {
+  NoexceptDependentSpecifierAssign& operator=(NoexceptDependentSpecifierAssign&&) noexcept(__is_integral(T));
+};
+
+struct ThrowParensSpecifierCtor {
+  ThrowParensSpecifierCtor(ThrowParensSpecifierCtor&&) throw();
+};
+
+struct ThrowParensSpecifierAssign {
+  ThrowParensSpecifierAssign& operator=(ThrowParensSpecifierAssign&&) throw();
+};
Index: clang/lib/Parse/ParseDeclCXX.cpp
===================================================================
--- clang/lib/Parse/ParseDeclCXX.cpp
+++ clang/lib/Parse/ParseDeclCXX.cpp
@@ -1622,6 +1622,7 @@
           tok::kw___is_signed,
           tok::kw___is_standard_layout,
           tok::kw___is_trivial,
+          tok::kw___is_trivially_equality_comparable,
           tok::kw___is_trivially_assignable,
           tok::kw___is_trivially_constructible,
           tok::kw___is_trivially_copyable,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148677.514797.patch
Type: text/x-patch
Size: 2794 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230419/81cf2a23/attachment.bin>


More information about the cfe-commits mailing list