[clang] [CIR] Add support for initializing classes with multiple vtables (PR #155275)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 25 13:57:24 PDT 2025


================
@@ -264,6 +289,37 @@ void CIRGenFunction::emitCtorPrologue(const CXXConstructorDecl *cd,
   }
 }
 
+static Address applyNonVirtualAndVirtualOffset(
+    mlir::Location loc, CIRGenFunction &cgf, Address addr,
+    CharUnits nonVirtualOffset, mlir::Value virtualOffset,
+    const CXXRecordDecl *derivedClass, const CXXRecordDecl *nearestVBase,
+    mlir::Type baseValueTy = {}, bool assumeNotNull = true) {
+  // Assert that we have something to do.
+  assert(!nonVirtualOffset.isZero() || virtualOffset != nullptr);
+
+  // Compute the offset from the static and dynamic components.
+  mlir::Value baseOffset;
----------------
AmrDeveloper wrote:

I think `baseOffset` is unused in this PR; the value is updated, but it is not used. Should it be removed from this PR?

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


More information about the cfe-commits mailing list