[PATCH] D125802: Fix std::has_unique_object_representations for _BitInt types with padding bits

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 18 05:56:10 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/ASTContext.cpp:2689
+  // A _BitInt type may not be unique if it has padding bits
+  // but if it is a bitfield the padding bits are not used
+  bool IsBitIntType =
----------------



================
Comment at: clang/lib/AST/ASTContext.cpp:2690-2691
+  // but if it is a bitfield the padding bits are not used
+  bool IsBitIntType =
+      !Field->getType()->isReferenceType() && Field->getType()->isBitIntType();
+  if (!Field->getType()->isReferenceType() && !IsBitIntType &&
----------------
A type can't be both a `_BitInt` and a reference at the same time, so I think you can drop the !reference type check here.


================
Comment at: clang/lib/AST/ASTContext.cpp:2809
+  if (Ty->isIntegralOrEnumerationType()) {
+    // Except _BitInt types that have padding bits
+    if (const auto *BIT = dyn_cast<BitIntType>(Ty))
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125802/new/

https://reviews.llvm.org/D125802



More information about the cfe-commits mailing list