[PATCH] D147904: [Clang] Fix cast to BigIntType in hasUniqueObjectRepresentations
Roy Jacobson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 10 12:12:09 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG016970d079c4: [Clang] Fix cast to BigIntType in hasUniqueObjectRepresentations (authored by royjacobson).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147904/new/
https://reviews.llvm.org/D147904
Files:
clang/lib/AST/ASTContext.cpp
clang/test/SemaCXX/type-traits.cpp
Index: clang/test/SemaCXX/type-traits.cpp
===================================================================
--- clang/test/SemaCXX/type-traits.cpp
+++ clang/test/SemaCXX/type-traits.cpp
@@ -2970,6 +2970,12 @@
bool b = __has_unique_object_representations(T);
};
+static_assert(!has_unique_object_representations<_BitInt(7)>::value, "BitInt:");
+static_assert(has_unique_object_representations<_BitInt(8)>::value, "BitInt:");
+static_assert(!has_unique_object_representations<_BitInt(127)>::value, "BitInt:");
+static_assert(has_unique_object_representations<_BitInt(128)>::value, "BitInt:");
+
+
namespace PR46209 {
// Foo has both a trivial assignment operator and a non-trivial one.
struct Foo {
Index: clang/lib/AST/ASTContext.cpp
===================================================================
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -2832,7 +2832,7 @@
// All integrals and enums are unique.
if (Ty->isIntegralOrEnumerationType()) {
// Except _BitInt types that have padding bits.
- if (const auto *BIT = dyn_cast<BitIntType>(Ty))
+ if (const auto *BIT = Ty->getAs<BitIntType>())
return getTypeSize(BIT) == BIT->getNumBits();
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147904.512214.patch
Type: text/x-patch
Size: 1221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230410/ce25113b/attachment.bin>
More information about the cfe-commits
mailing list