[clang] [llvm] [ThinLTO] Support dead RTTI data elimination under -fno-split-lto-unit (PR #126336)

Teresa Johnson via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 12 11:01:51 PST 2025


================
@@ -1592,6 +1592,7 @@ llvm::Value *ItaniumCXXABI::EmitTypeid(CodeGenFunction &CGF,
       cast<CXXRecordDecl>(SrcRecordTy->castAs<RecordType>()->getDecl());
   llvm::Value *Value = CGF.GetVTablePtr(ThisPtr, CGM.GlobalsInt8PtrTy,
                                         ClassDecl);
+  CGF.EmitTypeMetadataCodeForVCall(ClassDecl, Value, SourceLocation());
----------------
teresajohnson wrote:

EmitTypeMetadataCodeForVCall does some special handling if CFI is enabled. Is it correct to do that handling here? Alternatively, since this isn't a vcall, maybe refactor out the type test insertion from this method and call only that here. Also add a comment here (in particular with the current function name it is confusing since this isn't a vcall).

Should this handling be added to MicrosoftCXXABI as well? Asking because I notice that currently EmitTypeMetadataCodeForVCall is invoked for both ABIs. Alternatively, add a TODO there?

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


More information about the cfe-commits mailing list