================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to