Called By is one of the interactive graphs Understand can draw of your code — call trees, dependencies, control flow, and more.
Called By
Languages: Ada, Assembly, Basic, C#, C++, Fortran, Java, Jovial, Pascal, Python, Rust, VHDL, WebTargets: Functions, Subprograms
Variants: Classic, Cluster, Compare, Relationship, Simplified
Show what calls a selected function, directly or indirectly, including through virtual dispatch.
For a selected function, this shows an edge from each function that calls it, then recurses into whatever calls those functions in turn, building a multi-level tree of callers.
Whenever a call could have come from more than one target at runtime — like through virtual dispatch or a function pointer — the graph shows all possible targets.
Rooted at callDemo below, the graph shows it's called directly by CallbyDerivedA::pureVirtualCall and by altFirst. CallbyDerivedA::pureVirtualCall is itself called directly by first, and is also reachable from first through a virtual call on CallbyBase::pureVirtualCall. The inverse graph, Calls, shows the reverse relationship — everything the selected function calls.
See the following code and corresponding graph
void callDemo(int n);
class CallbyBase {
public:
virtual void pureVirtualCall() = 0;
};
class CallbyDerivedA : public CallbyBase {
public:
void pureVirtualCall() override { callDemo(0); };
};
class CallbyDerivedB : public CallbyBase {
public:
void pureVirtualCall() override {};
};
void first()
{
CallbyDerivedA obj;
obj.pureVirtualCall(); // direct call
CallbyBase *base = &obj;
base->pureVirtualCall(); // virtual call
}
void altFirst()
{
callDemo(1);
}
Called By - Classic
The Classic variant is similar to the Simplified variant, showing all relationships in a simple tree, but it uses a custom layout algorithm instead of Graphviz.
Called By - Cluster
The Cluster variant groups entities by their containing class/file/architecture.
Called By - Compare
The Compare variant shows how the graph has changed relative to the project's comparison database.
Called By - Relationship
The Relationship variant filters the graph to only paths connecting the two entities.
Called By - Simplified
The Simplified variant shows all relationships in a simple tree (no clusters)