Skip to content

Latest commit

 

History

History
44 lines (27 loc) · 1.43 KB

File metadata and controls

44 lines (27 loc) · 1.43 KB

CallGraphFrom for C++

Displays calls made from a specified function, showing the call graph outbound from the source function.

Overview

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.

Use Cases

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

Example

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.

Output Format

The query is a @kind problem query producing rows of:

  • select call, "Call from `source` to `callee`"

References