Get class method definition from .cpp file using clang CXXMethodDecl

Viewed 88

I want to get class methods' definition location and line numbers. Lets say I have .h file with single class containing one simple method declaration. Also I've got .cpp file with method definition. How am I supposed to obtain definition from .cpp file line numbers of given method? I tried using getDefinition() method on CXXMethodDecl* object, but it returns nullptr. When theres definition with declaration in .h file of method, simply getSourceRange() method works.

0 Answers
Related