Identify if a function is a member function

Hi everyone!
Recently I am curious about how LLVM express class in IR. I read a doc: Classes — Mapping High Level Constructs to LLVM IR documentation . It says it’s a trivial map from class to IR, namely adding an extra pointer as the first parameter. However, if one user also has a function whose first parameter is a pointer of the class, is there a method to identify such a function is member function of the class or not?

1 Like

I also met this problem, wonder if you have any solution till now : )

Well, I achieved it by a silly solution:

By calling demangle functions you can get the original name of a function. So you can check the prefix of the original name to check if it belongs to a class.