[clang] [CIR] Upstream RTTI Builder & RTTI for VTable Definitions (PR #160002)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 24 13:08:16 PDT 2025


================
@@ -47,6 +47,49 @@ cir::RecordType CIRGenVTables::getVTableType(const VTableLayout &layout) {
   return cgm.getBuilder().getAnonRecordTy(tys, /*incomplete=*/false);
 }
 
+/// At this point in the translation unit, does it appear that can we
+/// rely on the vtable being defined elsewhere in the program?
+///
+/// The response is really only definitive when called at the end of
+/// the translation unit.
+///
+/// The only semantic restriction here is that the object file should
+/// not contain a vtable definition when that vtable is defined
+/// strongly elsewhere.  Otherwise, we'd just like to avoid emitting
+/// vtables when unnecessary.
+/// TODO(cir): this should be merged into common AST helper for codegen.
+bool CIRGenVTables::isVTableExternal(const CXXRecordDecl *RD) {
----------------
andykaylor wrote:

```suggestion
bool CIRGenVTables::isVTableExternal(const CXXRecordDecl *rd) {
```

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


More information about the cfe-commits mailing list