I am implementing an interprocedural analysis in LLVM for C++ programs. For that, I need to get a list of possible call targets for each indirect call in the program. I am okay with the result being imprecise but it should be sound.
#include <iostream>
class X {
public:
virtual void vfun() {
return;
}
};
class Y : public X {
public:
virtual void vfun() {
return;
}
};
int main() {
X *x = new Y();
x->vfun();
}
For example, in the above code, I should get X::vfun() and Y::vfun() as possible call targets for the virtual call.
Does LLVM provide any API for this purpose? Or is there any open-source tool that will give me this information?