I need to identify virtual function call sites in my LLVM pass, as well as identify possible candidate functions which may be called at run time.
class B
{
virtual void F() { // do something }
};
class D : public B
{
void F() { // do something else }
};
B* d = new D();
d->F();
For example for the given hierarchy and call of F, identify both B::F and D::F as a possible candidates.
While looking for a solution, I came across Clang CFI (Control flow integration), where they said they are identifying if a virtual table pointer is a valid one by checking if it is in a set of candidate virtual table pointers. Thus I assume there is a way to get this information about inheritance hierarchy. But I was not able to find anything how to get this done in llvm.
So does anyone have an idea how this could be done?