[clang] [libclang] Add API to query more information about base classes. (PR #120300)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 10 13:18:51 PST 2025


================
@@ -3771,6 +3771,12 @@ CINDEX_LINKAGE enum CXRefQualifierKind clang_Type_getCXXRefQualifier(CXType T);
  */
 CINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor);
 
+/**
+ * Returns the offset in bits of a CX_CXXBaseSpecifier relative to the parent
+ * class.
+ */
+CINDEX_LINKAGE long long clang_getOffsetOfBase(CXCursor Parent, CXCursor Base);
----------------
efriedma-quic wrote:

clang_Type_getOffsetOf and clang_Cursor_getOffsetOfField use `long long`, so I went with the same for consistency.  I guess I could change the return type to `unsigned long long`, but a consistent API seems more important here.

size_t doesn't make sense: size_t is the host's size_t, not the target's size_t.  We don't want to truncate the result.

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


More information about the cfe-commits mailing list