[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:49 PDT 2026


================
@@ -9614,6 +9641,22 @@ unsigned clang_CXXMethod_isExplicit(CXCursor C) {
   return 0;
 }
 
+unsigned clang_Cursor_isConstexpr(CXCursor C) {
+  if (!clang_isDeclaration(C.kind))
+    return 0;
+
+  const Decl *D = cxcursor::getCursorDecl(C);
+  if (!D)
+    return 0;
+
+  if (const auto *VD = dyn_cast<VarDecl>(D))
----------------
AaronBallman wrote:

Can we have a test for lambda expressions too?
```
auto lam = [](int x, int y) constexpr { return x + y; };
```
I think this gets filtered out by the check for a declaration above, but do we want this to return true for a lambda expression that's constexpr? I think so.

Additionally, this may not handle variable or function templates correctly, should add test coverage for those cases too.

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


More information about the cfe-commits mailing list