[clang] [Clang] Fix __is_trivially_equality_comparable returning true with ineligebile defaulted overloads (PR #93113)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 27 08:43:56 PDT 2024


================
@@ -1126,9 +1126,6 @@ class QualType {
   /// Return true if this is a trivially relocatable type.
   bool isTriviallyRelocatableType(const ASTContext &Context) const;
 
-  /// Return true if this is a trivially equality comparable type.
-  bool isTriviallyEqualityComparableType(const ASTContext &Context) const;
----------------
AaronBallman wrote:

It's unfortunate that the other traits are implemented directly on `Type` but this one is in SemaExprCXX.cpp and isn't possible to compute without access to `Sema`. ISTM we should be able to answer this question on the type rather than requiring semantic analysis (considering potential uses like in clang-tidy where there is no `Sema` available).

Perhaps another way to approach this is with the `DefinitionData` for classes -- as we add members to the class, we build up information about whether something is trivially copyable, etc and store that on the bits defined in `CXXRecordDeclDefinitionBits.def`. Maybe we could do the same for equality comparable types, then we can leave this interface in `Type` and do special handling if the type is a `CXXRecordDecl`. WDYT?

https://github.com/llvm/llvm-project/pull/93113


More information about the cfe-commits mailing list