I am using libclang to parse .cpp
and get all function calls in the file.
However , the only returned function calls are the one defined at the parsed .h
/ .cpp
file not all the ones from the include files.
for example I am parsing example.cpp
which include
#include "a.h"
#include "example.h"
All calls for functions defined/declared in example.h are detected but it skips all function calls which are defined in a.h. How can I detect both of them ?
In a.h
foo ();
In example.hpp
boo();
In example.cpp
foo();
boo();
Only boo()
is detected as function call. It does not check for function call recursivly in all headers. How can I force this check ?
I am using this function to return function calls
CXChildVisitResult functionVisitor(CXCursor cursor){
CXCursorKind cursorKind = clang_getCursorKind(cursor);
CXString cursorSpelling = clang_getCursorSpelling(cursor);
if (cursorKind == CXCursor_CallExpr) {
CXString cursorUsr = clang_getCursorUSR(cursor);
print_function_prototype(cursor);
clang_disposeString(cursorUsr);
}
return CXChildVisit_Continue;
}