@@ -281,10 +281,13 @@ set<const llvm::Function *>
281281LLVMBasedICFG::getCalleesOfCallAt (const llvm::Instruction *n) const {
282282 if (llvm::isa<llvm::CallInst>(n) || llvm::isa<llvm::InvokeInst>(n)) {
283283 set<const llvm::Function *> Callees;
284- auto Caller = n->getFunction ();
284+ auto mapEntry = FunctionVertexMap.find (n->getFunction ());
285+ if (mapEntry == FunctionVertexMap.end ()) {
286+ return Callees;
287+ }
285288 out_edge_iterator ei, ei_end;
286289 for (boost::tie (ei, ei_end) =
287- boost::out_edges (FunctionVertexMap. at (Caller) , CallGraph);
290+ boost::out_edges (mapEntry-> second , CallGraph);
288291 ei != ei_end; ++ei) {
289292 auto source = boost::source (*ei, CallGraph);
290293 auto edge = CallGraph[*ei];
@@ -305,9 +308,13 @@ LLVMBasedICFG::getCalleesOfCallAt(const llvm::Instruction *n) const {
305308set<const llvm::Instruction *>
306309LLVMBasedICFG::getCallersOf (const llvm::Function *F) const {
307310 set<const llvm::Instruction *> CallersOf;
311+ auto mapEntry = FunctionVertexMap.find (F);
312+ if (mapEntry == FunctionVertexMap.end ()) {
313+ return CallersOf;
314+ }
308315 in_edge_iterator ei, ei_end;
309316 for (boost::tie (ei, ei_end) =
310- boost::in_edges (FunctionVertexMap. at (F) , CallGraph);
317+ boost::in_edges (mapEntry-> second , CallGraph);
311318 ei != ei_end; ++ei) {
312319 auto source = boost::source (*ei, CallGraph);
313320 auto edge = CallGraph[*ei];
0 commit comments