[llvm-dev] Retrieving the name of a indirect virtual method call in LLVM pass
via llvm-dev
llvm-dev at lists.llvm.org
Sun Jun 3 13:35:03 PDT 2018
Hi,
I have been implementing a CallGraphSCCPass that analyzes each function
invocation. Direct calls are not a problem, but currently I also need to
retrieve the name of the function in the case of virtual method calls. For
example:
struct A {
A() {}
virtual foo() {}
virtual ~A() {}
};
int main() {
A* a = new A;
a->foo();
}
In the pass, I can determine the name of the indirect call by using
CallInst::getCalledValue(), but that doesn't give any information on the
actual method that is being called, which should be foo(). The only "name" I
can get is the type of the class, in which this case is class.A.
Is there any way I can get the name of the virtual method (foo) that is
being invoked? It isn't in the bitcode except for when it is defined. I
tried taking a look at the whole-program-devirt source but can't find where
they are actually finding the names of the functions when building the
virtual tables for each class.
I would greatly appreciate any help on this and if it is possible at all.
Thanks,
Ben Fu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180603/153587d6/attachment-0001.html>
More information about the llvm-dev
mailing list