================
@@ -29,40 +44,57 @@ class InterpStack final {
   /// Destroys the stack, freeing up storage.
   ~InterpStack();
 
+  template <class T> struct alignas(void *) StackFrame {
+    static_assert(alignof(T) <= alignof(void *),
+                  "Unexpected overaligned object");
+
+    template <class... Args>
+    StackFrame(Args &&...args)
+        : v(std::forward<Args>(args)...), type(toPrimType<T>()) {}
+
+    static constexpr size_t getPaddingSize() {
+      if constexpr (sizeof(T) < sizeof(void*))
+        return sizeof(void*) - datasizeof_v<T> - 1;
+      else if constexpr (sizeof(T) == datasizeof_v<T>)
+        return sizeof(void*) - 1;
+      else
+        return sizeof(T) - datasizeof_v<T> - 1;
+    }
+
+    LLVM_NO_UNIQUE_ADDRESS T v;
+    LLVM_NO_UNIQUE_ADDRESS Padding<getPaddingSize()> padding;
+    PrimType type;
----------------
tbaederr wrote:

```suggestion
    LLVM_NO_UNIQUE_ADDRESS T V;
    LLVM_NO_UNIQUE_ADDRESS Padding<getPaddingSize()> Padding; // name conflict?
    PrimType T;
```
Using `T` for the PrimType is basically a convention at this point.


https://github.com/llvm/llvm-project/pull/224903
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to