I am learning to parse C++ files using Python + libclang with the help of this very informative (but slightly outdated) tutorial by Eli Bendersky.
My objective is to parse C++ files and identify the function boundaries for functions present in those file. I am expecting to build a python dictionary of this form:
{<func_name>:(<func_start_loc>, <func_end_loc>), ...}
To this end, I am able to get the function name (using cursor.spelling
for AST nodes that are of CursorKind.FUNCTION_DECL
or CursorKind.CXX_METHOD
kind) and the start location (using cursor.location
)
My question is, how do I get the end of function location