================
@@ -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.
+ */
+CINDEX_LINKAGE CXQualifiers clang_CXXMethod_getQualifiers(CXCursor C);
----------------
AaronBallman wrote:

Vlad and I discussed whether this interface is needed at all because you could 
go back to the function type to get this information, at least in theory. 
However, we convinced ourselves that this should be an operation on the 
declaration. Consider:
```c++
struct S {
  void foo() _Nullable {}
  void bar() const {}
};

decltype(&S::foo) f1;
decltype(&S::bar) f2;
```
The type for `f1 does not include `_Nullable` while the type for `f2` does 
include `const`. By operating on the declaration, we make it possible to 
support things like `f1`.

Nothing to change in the PR, just writing this down for the historical record.

https://github.com/llvm/llvm-project/pull/183305
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to