[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

Henrik G. Olsson via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 27 11:27:11 PST 2024


================
@@ -2000,6 +2001,21 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
     unsigned NumExpansions;
   };
 
+  class CountAttributedTypeBitfields {
+    friend class CountAttributedType;
+
+    LLVM_PREFERRED_TYPE(TypeBitfields)
+    unsigned : NumTypeBits;
+
+    /// The limit is 15.
----------------
hnrklssn wrote:

Why is the limit 15? From what I can tell `NumTypeBits` is 22, so with `CountInBytes` and `OrNull` that's 24 bits, which makes 15 seem very arbitrary. How about a static assert that `sizeof(CountAttributedTypeBitfields)` is less than or equal to some maximum, if that's the goal here.

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


More information about the cfe-commits mailing list