diff options
author | Andy Kaylor <akaylor@nvidia.com> | 2025-08-22 13:26:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-22 13:26:17 -0700 |
commit | ffe3768dfbbb3a598482d1f4a3dce4f02446340d (patch) | |
tree | 14a2eb37cf26aa9736d4c184f3b9fef553d4a461 /clang/lib/CIR/CodeGen/CIRGenModule.cpp | |
parent | b9987503d2ed2768ff8b64446049383412c7806b (diff) | |
download | llvm-ffe3768dfbbb3a598482d1f4a3dce4f02446340d.zip llvm-ffe3768dfbbb3a598482d1f4a3dce4f02446340d.tar.gz llvm-ffe3768dfbbb3a598482d1f4a3dce4f02446340d.tar.bz2 |
[CIR] Add support for emitting vtables (#154808)
This adds a simplified version of the code to emit vtables. It does not
yet handle RTTI or cases that require multiple vtables.
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenModule.cpp')
-rw-r--r-- | clang/lib/CIR/CodeGen/CIRGenModule.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index a557d2a..46bca51 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -845,7 +845,7 @@ void CIRGenModule::emitGlobalDefinition(clang::GlobalDecl gd, emitGlobalFunctionDefinition(gd, op); if (method->isVirtual()) - errorNYI(method->getSourceRange(), "virtual member function"); + getVTables().emitThunks(gd); return; } @@ -2151,6 +2151,18 @@ bool CIRGenModule::verifyModule() const { return mlir::verify(theModule).succeeded(); } +mlir::Attribute CIRGenModule::getAddrOfRTTIDescriptor(mlir::Location loc, + QualType ty, bool forEh) { + // Return a bogus pointer if RTTI is disabled, unless it's for EH. + // FIXME: should we even be calling this method if RTTI is disabled + // and it's not for EH? + if (!shouldEmitRTTI(forEh)) + return builder.getConstNullPtrAttr(builder.getUInt8PtrTy()); + + errorNYI(loc, "getAddrOfRTTIDescriptor"); + return mlir::Attribute(); +} + // TODO(cir): this can be shared with LLVM codegen. CharUnits CIRGenModule::computeNonVirtualBaseClassOffset( const CXXRecordDecl *derivedClass, |