clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Friends
clang::CallGraph Class Reference

#include <CallGraph.h>

Inheritance diagram for clang::CallGraph:
Inheritance graph
[legend]
Collaboration diagram for clang::CallGraph:
Collaboration graph
[legend]

List of all members.

Public Types

typedef FunctionMapTy::iterator iterator
typedef
FunctionMapTy::const_iterator 
const_iterator
typedef llvm::SetVector
< CallGraphNode * >::iterator 
nodes_iterator
typedef llvm::SetVector
< CallGraphNode * >
::const_iterator 
const_nodes_iterator

Public Member Functions

 CallGraph ()
 ~CallGraph ()
void addToCallGraph (Decl *D)
 Populate the call graph with the functions in the given declaration.
CallGraphNodegetNode (const Decl *) const
 Lookup the node for the given declaration.
CallGraphNodegetOrInsertNode (Decl *)
 Lookup the node for the given declaration. If none found, insert one into the graph.
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
unsigned size () const
 Get the number of nodes in the graph.
CallGraphNodegetRoot () const
nodes_iterator parentless_begin ()
nodes_iterator parentless_end ()
const_nodes_iterator parentless_begin () const
const_nodes_iterator parentless_end () const
void print (raw_ostream &os) const
void dump () const
void viewGraph () const
bool VisitFunctionDecl (FunctionDecl *FD)
 Part of recursive declaration visitation.
bool VisitObjCMethodDecl (ObjCMethodDecl *MD)
 Part of recursive declaration visitation.

Static Public Member Functions

static bool includeInGraph (const Decl *D)
 Determine if a declaration should be included in the graph.

Friends

class CallGraphNode

Detailed Description

Definition at line 34 of file CallGraph.h.


Member Typedef Documentation

typedef FunctionMapTy::const_iterator clang::CallGraph::const_iterator

Definition at line 76 of file CallGraph.h.

Definition at line 93 of file CallGraph.h.

typedef FunctionMapTy::iterator clang::CallGraph::iterator

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

Definition at line 75 of file CallGraph.h.

Iterators through all the nodes of the graph that have no parent. These are the unreachable nodes, which are either unused or are due to us failing to add a call edge due to the analysis imprecision.

Definition at line 92 of file CallGraph.h.


Constructor & Destructor Documentation

CallGraph::CallGraph ( )

Definition at line 55 of file CallGraph.cpp.

References getOrInsertNode().

CallGraph::~CallGraph ( )

Definition at line 59 of file CallGraph.cpp.


Member Function Documentation

void clang::CallGraph::addToCallGraph ( Decl D) [inline]

Populate the call graph with the functions in the given declaration.

Recursively walks the declaration to find all the dependent Decls as well.

Definition at line 59 of file CallGraph.h.

References clang::RecursiveASTVisitor< CallGraph >::TraverseDecl().

iterator clang::CallGraph::begin ( ) [inline]
const_iterator clang::CallGraph::begin ( ) const [inline]

Definition at line 79 of file CallGraph.h.

void CallGraph::dump ( ) const

Definition at line 145 of file CallGraph.cpp.

References print().

iterator clang::CallGraph::end ( ) [inline]
const_iterator clang::CallGraph::end ( ) const [inline]

Definition at line 80 of file CallGraph.h.

CallGraphNode * CallGraph::getNode ( const Decl F) const

Lookup the node for the given declaration.

Definition at line 107 of file CallGraph.cpp.

CallGraphNode * CallGraph::getOrInsertNode ( Decl F)

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

Definition at line 113 of file CallGraph.cpp.

References CallGraphNode.

Referenced by CallGraph().

CallGraphNode* clang::CallGraph::getRoot ( ) const [inline]

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

Definition at line 87 of file CallGraph.h.

Referenced by llvm::GraphTraits< clang::CallGraph * >::getEntryNode(), llvm::GraphTraits< const clang::CallGraph * >::getEntryNode(), and llvm::DOTGraphTraits< const CallGraph * >::getNodeLabel().

bool CallGraph::includeInGraph ( const Decl D) [static]

Determine if a declaration should be included in the graph.

Definition at line 68 of file CallGraph.cpp.

References clang::IdentifierInfo::getName().

Referenced by VisitFunctionDecl(), and VisitObjCMethodDecl().

nodes_iterator clang::CallGraph::parentless_begin ( ) [inline]

Definition at line 94 of file CallGraph.h.

const_nodes_iterator clang::CallGraph::parentless_begin ( ) const [inline]

Definition at line 97 of file CallGraph.h.

nodes_iterator clang::CallGraph::parentless_end ( ) [inline]

Definition at line 95 of file CallGraph.h.

const_nodes_iterator clang::CallGraph::parentless_end ( ) const [inline]

Definition at line 99 of file CallGraph.h.

void CallGraph::print ( raw_ostream &  os) const

Definition at line 125 of file CallGraph.cpp.

References begin(), and end().

Referenced by dump().

unsigned clang::CallGraph::size ( ) const [inline]

Get the number of nodes in the graph.

Definition at line 83 of file CallGraph.h.

Referenced by llvm::GraphTraits< clang::CallGraph * >::size(), and llvm::GraphTraits< const clang::CallGraph * >::size().

void CallGraph::viewGraph ( ) const

Definition at line 149 of file CallGraph.cpp.

bool clang::CallGraph::VisitFunctionDecl ( FunctionDecl FD) [inline]

Part of recursive declaration visitation.

Definition at line 106 of file CallGraph.h.

References includeInGraph(), and clang::FunctionDecl::isGlobal().

bool clang::CallGraph::VisitObjCMethodDecl ( ObjCMethodDecl MD) [inline]

Part of recursive declaration visitation.

Definition at line 118 of file CallGraph.h.

References includeInGraph().


Friends And Related Function Documentation

friend class CallGraphNode [friend]

Definition at line 35 of file CallGraph.h.

Referenced by getOrInsertNode().


The documentation for this class was generated from the following files: