[clang] [clang] Implement constexpr heap allocation alignments (PR #174549)

Nikolas Klauser via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 16 04:51:10 PDT 2026


================
@@ -63,30 +64,48 @@ class TypeInfoLValue {
 
 /// Symbolic representation of a dynamic allocation.
 class DynamicAllocLValue {
-  unsigned Index;
+  // lower NumAlignmentBits: alignment exponent
+  // remaining bits: allocation index incremented by one
+  // value of zero indicates distinct empty state
+  unsigned AlignAndIndex;
----------------
philnik777 wrote:

We actually only need two bits to for the pointer union and we can use a `uintptr_t` instead of `unsigned`. That gives us plenty of room on 64 bit platforms and on 32 bit platforms 2^25 allocations seems like it should be enough?

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


More information about the cfe-commits mailing list