I have a Lib and multiple Applications. I want to gather usage statistics about function calls to Lib's API from Apps. Basically my current process is:
- Parse the Lib for all functions/methods
- Output the info in a formatted way
- Use that output to gather stats from the Apps.
I'm currently using the libclang API that offers cross-referencing in the form of USRs so I'm building an index of functions and use that when parsing the Apps. The problem is that this API is limited and that's why I want to move to Libtooling.
I've looked through libtooling's API but I haven't been able to find anything similar. So my question is what would be the best way to achieve that "cross-referencing" using Libtooling.
An example would be:
> lib.h
class Foo {
public:
void bar();
};
> app.cpp
#include "lib.h"
int main(void) {
Foo f;
f.bar();
return 0;
}
And expected output would be a json file:
{
"name": "bar",
"location": { "file": "lib.h", "line": 5},
"references": [{"file": "app.cpp", "line": 8}]
}