// // Function: getAllCallees() // // Description: // Given a DSCallSite, add to the list the functions that can be called by // the call site *if* it is resolvable. Uses 'applyCallsiteFilter' to // only add the functions that are valid targets of this callsite. // void BUDataStructures:: getAllCallees(const DSCallSite &CS, FuncSet &Callees) { // // FIXME: Should we check for the Unknown flag on indirect call sites? // // Direct calls to functions that have bodies are always resolvable. // Indirect function calls that are for a complete call site (the analysis // knows everything about the call site) and do not target external functions // are also resolvable. // if (CS.isDirectCall()) { if (!CS.getCalleeFunc()->isDeclaration()) Callees.insert(CS.getCalleeFunc()); } else if (CS.getCalleeNode()->isCompleteNode()) { // Get all callees. if (!CS.getCalleeNode()->isExternFuncNode()) { // Get all the callees for this callsite FuncSet TempCallees; CS.getCalleeNode()->addFullFunctionSet(TempCallees); // Filter out the ones that are invalid targets with respect // to this particular callsite. applyCallsiteFilter(CS, TempCallees); // Insert the remaining callees (legal ones, if we're filtering) // into the master 'Callees' list Callees.insert(TempCallees.begin(), TempCallees.end()); } } }
static void GetAllCallees(const DSCallSite &CS, std::vector<const Function*> &Callees) { if (CS.isDirectCall()) { if (!CS.getCalleeFunc()->isDeclaration()) Callees.push_back(CS.getCalleeFunc()); } else if (!CS.getCalleeNode()->NodeType.isIncompleteNode()) { // Get all callees. if (!CS.getCalleeNode()->NodeType.isExternFunctionNode()) CS.getCalleeNode()->addFullFunctionList(Callees); } }
static void GetAnyCallees(const DSCallSite &CS, std::vector<const Function*> &Callees) { if (CS.isDirectCall()) { if (!CS.getCalleeFunc()->isDeclaration()) Callees.push_back(CS.getCalleeFunc()); } else { // Get all callees. unsigned OldSize = Callees.size(); CS.getCalleeNode()->addFullFunctionList(Callees); // If any of the callees are unresolvable, remove them for (unsigned i = OldSize; i != Callees.size(); ) if (Callees[i]->isDeclaration()) { Callees.erase(Callees.begin()+i); } else ++i; } }