[clang] [CodeGen] Ensure relative vtables use llvm.type.checked.load.relative (PR #126785)

via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 20 11:53:28 PST 2025


================
@@ -2937,9 +2937,13 @@ llvm::Value *CodeGenFunction::EmitVTableTypeCheckedLoad(
       CGM.CreateMetadataIdentifierForType(QualType(RD->getTypeForDecl(), 0));
   llvm::Value *TypeId = llvm::MetadataAsValue::get(CGM.getLLVMContext(), MD);
 
+  auto checked_load = CGM.getVTables().useRelativeLayout()
----------------
PiJoules wrote:

> `CheckedLoad`?

Done

> It doesn't need to be in this change but it would be nice to simplify things here a bit and instead of having three accessors for the relative vtables bit (`CGM.getLangOpts().RelativeCXXABIVTables`, `CGM.getItaniumVTableContext().isRelativeLayout()`, `CGM.getVTables().useRelativeLayout()`), just have one. IMO that should be the one on `LangOpts` and the driver should make sure it isn't set to true with the MS ABI.

I agree. I'll make a change for this after this lands

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


More information about the cfe-commits mailing list