trelau wrote:

For what it's worth, to get around my issue in 
https://github.com/llvm/llvm-project/issues/121502 I followed your same pattern 
here and added a ```get_methods()``` function to Python (and a new libclang 
function ```clang_visitCXXMethods```) to access the class methods.

Looking at 
[CXXRecordDecl](https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html),
 perhaps the following might all be useful to add to the libclang API 
(including Python):
- methods()
- fields()
- ctors()?
- friends()?

For my purposes of parsing C++ headers and generating Python bindings via 
pybind11, this bases PR plus adding the ```get_methods()``` function would make 
things much easier (ctors and friends seem like more "nice to have" and ctors 
seem to come through in "methods" anyway and can be determined by the cursor 
kind property).

Adding ```get_methods``` was basically copy/pasting your work (see libclang 
function 
[here](https://github.com/llvm/llvm-project/issues/121502#issuecomment-2571512174)).

I'll open a PR for the ```get_methods()``` addition (and maybe I'll try the 
others if they work as I imagine them to).

https://github.com/llvm/llvm-project/pull/120300
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to