[clang] [clang][NFC] Refactor enums that hold size of `Type` and `DeclContext` bit-fields (PR #70296)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 26 05:37:27 PDT 2023


================
@@ -1819,10 +1812,10 @@ class DeclContext {
     SourceLocation AtStart;
   };
 
-  /// Number of non-inherited bits in ObjCContainerDeclBitfields.
+  /// Number of inherited and non-inherited bits in ObjCContainerDeclBitfields.
   /// Note that here we rely on the fact that SourceLocation is 32 bits
   /// wide. We check this with the static_assert in the ctor of DeclContext.
-  enum { NumObjCContainerDeclBits = 64 - NumDeclContextBits };
+  enum { NumObjCContainerDeclBits = 64 };
----------------
AaronBallman wrote:

```suggestion
  enum { NumObjCContainerDeclBits = NumDeclContextBits + sizeof(SourceLocation) };
```

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


More information about the cfe-commits mailing list