| 880 | } |
| 881 | |
| 882 | bool RDAnalyzer::isTargetMethodInvocation(const RDNode &Node, |
| 883 | const llvm::CallBase &CB) { |
| 884 | |
| 885 | // CallBase should call non static method invocation. |
| 886 | if (!isNonStaticMethodInvocation(CB)) |
| 887 | return false; |
| 888 | |
| 889 | // Getting an argument index of the instance of a class. |
| 890 | unsigned ClsIndex = 0; |
| 891 | if (CB.hasStructRetAttr()) |
| 892 | ClsIndex += 1; |
| 893 | auto *Arg = CB.getArgOperand(ClsIndex); |
| 894 | |
| 895 | // Checks the instance of a class is same as the tracing target. |
| 896 | auto Targets = RDTarget::create(*Arg, &Space); |
| 897 | if (std::find_if(Targets.begin(), Targets.end(), [&Node](const auto &Src) { |
| 898 | return Node.getTarget() == *Src; |
| 899 | }) == Targets.end()) |
| 900 | return false; |
| 901 | |
| 902 | return true; |
| 903 | } |
| 904 | |
| 905 | bool RDAnalyzer::isNonStaticMethodInvocation(const llvm::CallBase &CB) const { |
| 906 | |