[clang] [CIR] Add vptr type and generate vptr field when needed (PR #151377)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 1 09:24:25 PDT 2025


================
@@ -697,6 +697,24 @@ BoolType::getABIAlignment(const ::mlir::DataLayout &dataLayout,
   return 1;
 }
 
+//===----------------------------------------------------------------------===//
+//  VPtrType Definitions
+//===----------------------------------------------------------------------===//
+
+llvm::TypeSize
+VPtrType::getTypeSizeInBits(const ::mlir::DataLayout &dataLayout,
+                            ::mlir::DataLayoutEntryListRef params) const {
+  // FIXME: consider size differences under different ABIs
+  return llvm::TypeSize::getFixed(64);
+}
+
+uint64_t
+VPtrType::getABIAlignment(const ::mlir::DataLayout &dataLayout,
+                          ::mlir::DataLayoutEntryListRef params) const {
+  // FIXME: consider alignment differences under different ABIs
+  return 8;
+}
----------------
andykaylor wrote:

Not really. I copied this code from another type, and I guess it had the scoping that way. I'll fix it.

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


More information about the cfe-commits mailing list