[clang] [llvm] [clang][DebugInfo] Add symbol for debugger with VTable information. (PR #130255)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Tue May 13 06:03:16 PDT 2025


================
@@ -1816,6 +1816,15 @@ class CodeGenModule : public CodeGenTypeCache {
   void requireVectorDestructorDefinition(const CXXRecordDecl *RD);
   bool classNeedsVectorDestructor(const CXXRecordDecl *RD);
 
+  // Helper to get the alignment for a variable.
+  unsigned getGlobalVarAlignment(const VarDecl *D = nullptr) {
+    LangAS AS = GetGlobalVarAddressSpace(D);
+    unsigned PAlign = getItaniumVTableContext().isRelativeLayout()
+                          ? 32
+                          : getTarget().getPointerAlign(AS);
+    return PAlign;
+  }
+
----------------
jmorse wrote:

It makes sense to refactor this out; I feel the name of the function should contain "vtable" somewhere though, it's fundamentally tied to producing vtable information as there's a call to `getItaniumVTableContext`, yes? There's a small risk that someone uses it for a different purpose, which we can fix by putting "vtable" in the name.

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


More information about the llvm-commits mailing list