[clang] [libclang] Add clang_CXXMethod_getQualifiers, clang_Cursor_isConstexpr, and clang_CXXMethod_isExplicitObjectMemberFunction (PR #183305)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 29 07:02:48 PDT 2026


================
@@ -4885,6 +4893,37 @@ CINDEX_LINKAGE unsigned clang_EnumDecl_isScoped(CXCursor C);
  */
 CINDEX_LINKAGE unsigned clang_CXXMethod_isConst(CXCursor C);
 
+/**
+ * Set of qualifiers (const, volatile, __restrict) of a C++ member function
+ * or member function template.
+ */
+typedef struct {
+  unsigned Const : 1;
+  unsigned Volatile : 1;
+  unsigned Restrict : 1;
+  unsigned /*Reserved for other qualifiers*/ : 29;
+} CXQualifiers;
+
+/**
+ * Retrieve the set of qualifiers for a C++ member function or member
+ * function template.
+ *
+ * If the cursor does not refer to a C++ member function or member function
+ * template, a zero-initialized CXQualifiers is returned.
+ *
+ * For explicit object member functions (C++23), this returns zero-initialized
+ * CXQualifiers. Use \c clang_CXXMethod_isExplicitObjectMemberFunction to
+ * distinguish explicit from implicit object member functions.
----------------
AaronBallman wrote:

I think it'd make sense to put a comment on `clang_CXXMethod_isConst` pointing users to this more general interface and we can "soft" deprecate that function by commenting that its use is discouraged.

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


More information about the cfe-commits mailing list