18 #ifndef LLVM_CLANG_ANALYSIS_CALLGRAPH_H 19 #define LLVM_CLANG_ANALYSIS_CALLGRAPH_H 23 #include "llvm/ADT/DenseMap.h" 24 #include "llvm/ADT/GraphTraits.h" 25 #include "llvm/ADT/STLExtras.h" 26 #include "llvm/ADT/SetVector.h" 27 #include "llvm/ADT/SmallVector.h" 46 llvm::DenseMap<const Decl *, std::unique_ptr<CallGraphNode>>;
49 FunctionMapTy FunctionMap;
87 unsigned size()
const {
return FunctionMap.size(); }
99 void print(raw_ostream &os)
const;
125 addNodeForDecl(MD,
true);
137 void addNodeForDecl(
Decl *D,
bool IsGlobal);
166 bool empty()
const {
return CalledFunctions.empty(); }
167 unsigned size()
const {
return CalledFunctions.size(); }
170 CalledFunctions.push_back(N);
175 void print(raw_ostream &os)
const;
212 return P.second.get();
217 mapped_iterator<clang::CallGraph::iterator, decltype(&CGGetValue)>;
238 return P.second.get();
243 mapped_iterator<clang::CallGraph::const_iterator, decltype(&CGGetValue)>;
258 #endif // LLVM_CLANG_ANALYSIS_CALLGRAPH_H The AST-based call graph.
Represents a function declaration or definition.
NodeType::iterator ChildIteratorType
llvm::SetVector< CallGraphNode * >::iterator nodes_iterator
Iterators through all the nodes of the graph that have no parent.
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Stmt - This represents one statement.
Decl - This represents one declaration (or definition), e.g.
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const_iterator begin() const
SmallVectorImpl< CallRecord >::const_iterator const_iterator
llvm::SetVector< CallGraphNode * >::const_iterator const_nodes_iterator
ObjCMethodDecl - Represents an instance or class method declaration.
CallGraphNode * getOrInsertNode(Decl *)
Lookup the node for the given declaration.
static ChildIteratorType child_end(NodeType *N)
void addCallee(CallGraphNode *N)
bool TraverseDecl(Decl *D)
Recursively visit a declaration, by dispatching to Traverse*Decl() based on the argument's dynamic ty...
mapped_iterator< clang::CallGraph::const_iterator, decltype(&CGGetValue)> nodes_iterator
static unsigned size(const clang::CallGraph *CG)
FunctionMapTy::iterator iterator
static NodeType * getEntryNode(const clang::CallGraph *CGN)
bool shouldWalkTypesOfTypeLocs() const
static nodes_iterator nodes_begin(clang::CallGraph *CG)
const_iterator begin() const
void addNodesForBlocks(DeclContext *D)
static NodeType * getEntryNode(const clang::CallGraphNode *CGN)
static nodes_iterator nodes_begin(const clang::CallGraph *CG)
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
FunctionMapTy::const_iterator const_iterator
friend class CallGraphNode
bool isThisDeclarationADefinition() const
Returns whether this specific declaration of the function is also a definition that does not contain ...
SmallVectorImpl< CallRecord >::iterator iterator
static clang::CallGraphNode * CGGetValue(clang::CallGraph::const_iterator::value_type &P)
static ChildIteratorType child_end(NodeType *N)
void print(raw_ostream &os) const
static ChildIteratorType child_begin(NodeType *N)
bool VisitFunctionDecl(FunctionDecl *FD)
Part of recursive declaration visitation.
mapped_iterator< clang::CallGraph::iterator, decltype(&CGGetValue)> nodes_iterator
static nodes_iterator nodes_end(clang::CallGraph *CG)
bool TraverseStmt(Stmt *S)
static ChildIteratorType child_begin(NodeType *N)
static bool includeInGraph(const Decl *D)
Determine if a declaration should be included in the graph.
const_iterator end() const
static nodes_iterator nodes_end(const clang::CallGraph *CG)
Dataflow Directional Tag Classes.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
static NodeType * getEntryNode(clang::CallGraphNode *CGN)
CallGraphNode * getNode(const Decl *) const
Lookup the node for the given declaration.
CallGraphNode * getRoot() const
\ brief Get the virtual root of the graph, all the functions available externally are represented as ...
static NodeType * getEntryNode(clang::CallGraph *CGN)
iterator begin()
Iterators through all the callees/children of the node.
static clang::CallGraphNode * CGGetValue(clang::CallGraph::const_iterator::value_type &P)
static unsigned size(clang::CallGraph *CG)
const_iterator end() const
NodeType::const_iterator ChildIteratorType
void addToCallGraph(Decl *D)
Populate the call graph with the functions in the given declaration.
unsigned size() const
Get the number of nodes in the graph.
bool VisitObjCMethodDecl(ObjCMethodDecl *MD)
Part of recursive declaration visitation.
iterator begin()
Iterators through all the elements in the graph.
bool isGlobal() const
Determines whether this is a global function.