class CallGraph

Declaration

class CallGraph : public RecursiveASTVisitor { /* full declaration omitted */ };

Description

The AST-based call graph. The call graph extends itself with the given declarations by implementing the recursive AST visitor, which constructs the graph by visiting the given declarations.

Declared at: clang/include/clang/Analysis/CallGraph.h:42

Inherits from: RecursiveASTVisitor

Member Variables

private clang::CallGraph::FunctionMapTy FunctionMap
FunctionMap owns all CallGraphNodes.
private clang::CallGraphNode* Root
This is a virtual root node that has edges to all the functions.

Method Overview

Methods

CallGraph()

Declared at: clang/include/clang/Analysis/CallGraph.h:55

bool TraverseStmt(clang::Stmt* S)

Declared at: clang/include/clang/Analysis/CallGraph.h:136

Parameters

clang::Stmt* S

bool VisitFunctionDecl(clang::FunctionDecl* FD)

Description

Part of recursive declaration visitation. We recursively visit all the declarations to collect the root functions.

Declared at: clang/include/clang/Analysis/CallGraph.h:112

Parameters

clang::FunctionDecl* FD

bool VisitObjCMethodDecl(
    clang::ObjCMethodDecl* MD)

Description

Part of recursive declaration visitation.

Declared at: clang/include/clang/Analysis/CallGraph.h:127

Parameters

clang::ObjCMethodDecl* MD

void addNodeForDecl(clang::Decl* D, bool IsGlobal)

Description

Add the given declaration to the call graph.

Declared at: clang/include/clang/Analysis/CallGraph.h:144

Parameters

clang::Decl* D
bool IsGlobal

void addNodesForBlocks(clang::DeclContext* D)

Declared at: clang/include/clang/Analysis/CallGraph.h:108

Parameters

clang::DeclContext* D

void addToCallGraph(clang::Decl* D)

Description

Populate the call graph with the functions in the given declaration. Recursively walks the declaration to find all the dependent Decls as well.

Declared at: clang/include/clang/Analysis/CallGraph.h:62

Parameters

clang::Decl* D

clang::CallGraph::iterator begin()

Description

Iterators through all the elements in the graph. Note, this gives non-deterministic order.

Declared at: clang/include/clang/Analysis/CallGraph.h:86

clang::CallGraph::const_iterator begin() const

Declared at: clang/include/clang/Analysis/CallGraph.h:88

void dump() const

Declared at: clang/include/clang/Analysis/CallGraph.h:105

clang::CallGraph::iterator end()

Declared at: clang/include/clang/Analysis/CallGraph.h:87

clang::CallGraph::const_iterator end() const

Declared at: clang/include/clang/Analysis/CallGraph.h:89

clang::CallGraphNode* getNode(
    const clang::Decl*) const

Description

Lookup the node for the given declaration.

Declared at: clang/include/clang/Analysis/CallGraph.h:75

Parameters

const clang::Decl*

clang::CallGraphNode* getOrInsertNode(
    clang::Decl*)

Description

Lookup the node for the given declaration. If none found, insert one into the graph.

Declared at: clang/include/clang/Analysis/CallGraph.h:79

Parameters

clang::Decl*

clang::CallGraphNode* getRoot() const

Description

Get the virtual root of the graph, all the functions available externally are represented as callees of the node.

Declared at: clang/include/clang/Analysis/CallGraph.h:96

static bool includeCalleeInGraph(
    const clang::Decl* D)

Description

Determine if a declaration should be included in the graph for the purposes of being a callee. This is similar to includeInGraph except it permits declarations, not just definitions.

Declared at: clang/include/clang/Analysis/CallGraph.h:72

Parameters

const clang::Decl* D

static bool includeInGraph(const clang::Decl* D)

Description

Determine if a declaration should be included in the graph.

Declared at: clang/include/clang/Analysis/CallGraph.h:67

Parameters

const clang::Decl* D

void print(llvm::raw_ostream& os) const

Declared at: clang/include/clang/Analysis/CallGraph.h:104

Parameters

llvm::raw_ostream& os

bool shouldVisitImplicitCode() const

Declared at: clang/include/clang/Analysis/CallGraph.h:140

bool shouldVisitTemplateInstantiations() const

Declared at: clang/include/clang/Analysis/CallGraph.h:139

bool shouldWalkTypesOfTypeLocs() const

Declared at: clang/include/clang/Analysis/CallGraph.h:138

unsigned int size() const

Description

Get the number of nodes in the graph.

Declared at: clang/include/clang/Analysis/CallGraph.h:92

void viewGraph() const

Declared at: clang/include/clang/Analysis/CallGraph.h:106

~CallGraph()

Declared at: clang/include/clang/Analysis/CallGraph.h:56