how should I use clang to locate every method in my project?

I need to locate every method in my project,including C, C++, ObjC. That is I need to get each method’s name start position and end position.

I have tried to use libTooling to write a tool in clang, it went well with C/C++(I searched for FunctionDecl in the source code), but with ObjC code, it came out with a lot of errors(I searched for ObjCMethodDecl).

Now, I am wondering if there is a tool or plugin in clang that I can use to locate the functions.

Thx~

I need to locate every method in my project,including C, C++, ObjC. That is I need to get each method’s name start position and end position.

I have tried to use libTooling to write a tool in clang, it went well with C/C++(I searched for FunctionDecl in the source code), but with ObjC code, it came out with a lot of errors(I searched for ObjCMethodDecl).

This is the right approach - but without knowing the errors we cannot really help :slight_smile: