[PATCH] D151625: [clang] Add `clang::equality_operator_compares_members_lexicographically`

Nikolas Klauser via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 27 21:05:29 PDT 2023


philnik created this revision.
philnik added reviewers: aaron.ballman, erichkeane.
Herald added a subscriber: dschuff.
Herald added a project: All.
philnik requested review of this revision.
Herald added subscribers: cfe-commits, aheejin.
Herald added a project: clang.

This attribute is equivalent to a defaulted member equality comparison for the purposes of __is_trivially_equality_comparable. The difference is that it doesn't try to do ADL calls when instantiating a class template. We encountered this problem while trying to make classes in libc++ trivially equality comparable. It can be used to guarantee that enums are trivially equality comparable (which is more of a bonus than a good reason to add this attribute).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151625

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/lib/AST/Type.cpp
  clang/test/SemaCXX/attr-equality-operator-compares-members-lexicographically.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151625.526309.patch
Type: text/x-patch
Size: 15087 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230528/28b1d5e8/attachment.bin>


More information about the cfe-commits mailing list