Displays calls made from a specified function, showing the call graph outbound from the source function.
This query identifies all function calls made within the body of a named function, producing an outbound call graph. Given a source function name, it reports each call site and the callee, which is useful for understanding function dependencies and call chains.
The query accepts function names via an external predicate (sourceFunction) and supports both simple and qualified name matching.
This query is primarily used for:
- Mapping outbound dependencies of a specific function
- Understanding what a function calls and in what order
- Analyzing call chains for refactoring or security review
The following C++ code demonstrates outbound calls from sourceFunc:
void helper1() {}
void helper2() { helper1(); }
void sourceFunc() { // Source function for analysis
helper1();
helper2();
}Running with sourceFunction = "sourceFunc" produces results showing each call site with the message pattern Call from `sourceFunc` to `helper1.
The query is a @kind problem query producing rows of:
select call, "Call from `source` to `callee`"