[clang] [llvm] [clang][DebugInfo] Add symbol for debugger with VTable information. (PR #130255)
Michael Buch via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 7 03:23:35 PST 2025
================
@@ -2518,6 +2518,59 @@ StringRef CGDebugInfo::getVTableName(const CXXRecordDecl *RD) {
return internString("_vptr$", RD->getNameAsString());
}
+// Emit symbol for the debugger that points to the vtable address for
+// the given class. The symbol is named as '_vtable$'.
+// The debugger does not need to know any details about the contents of the
+// vtable as it can work this out using its knowledge of the ABI and the
+// existing information in the DWARF. The type is assumed to be 'void *'.
+void CGDebugInfo::emitVTableSymbol(llvm::GlobalVariable *VTable,
+ const CXXRecordDecl *RD) {
+ ASTContext &Context = CGM.getContext();
+ SmallString<64> Buffer;
+ Twine SymbolName = internString("_vtable$");
+ StringRef SymbolNameRef = SymbolName.toStringRef(Buffer);
----------------
Michael137 wrote:
Don't think we need the call to `internString` here? AFAIU it's just used when we require the copy of a string and don't want to heap allocate?
https://github.com/llvm/llvm-project/pull/130255
More information about the cfe-commits
mailing list