MCPcopy Create free account
hub / github.com/Samsung/UTopia / getCalledFunctions

Method getCalledFunctions

lib/indcallsolver/IndCallSolverMgr.cpp:56–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56std::set<const Function *>
57IndCallSolverMgr::getCalledFunctions(const CallBase &CB) const {
58 // Step 1. check strip Pointer
59 auto *CO = CB.getCalledOperand();
60 if (!CO)
61 return {};
62
63 auto *V = CO->stripPointerCasts();
64 if (!V)
65 return {};
66
67 if (V->getName() != "") {
68 if (auto *F = dyn_cast<Function>(V))
69 return {F};
70
71 if (auto *GA = dyn_cast<GlobalAlias>(V)) {
72 const auto *F = dyn_cast_or_null<Function>(GA->getAliasee());
73 if (F)
74 return {F};
75 }
76
77 return {};
78 }
79
80 // Step 2. check callee MD
81 auto *Node = CB.getMetadata(LLVMContext::MD_callees);
82 if (Node)
83 return {mdconst::extract<Function>(Node->getOperand(0))};
84
85 for (const auto &Solver : Solvers) {
86 assert(Solver && "Unexpected Program State");
87
88 auto Result = Solver->solve(CB);
89 if (Result.size() > 0)
90 return Result;
91 }
92 return {};
93}

Callers 3

handleUserMethod · 0.80
foundMethod · 0.80
notfoundMethod · 0.80

Calls 3

sizeMethod · 0.80
getNameMethod · 0.45
solveMethod · 0.45

Tested by 2

foundMethod · 0.64
notfoundMethod · 0.64