clang: clang::CallGraph Class Reference (original) (raw)
The AST-based call graph. More...
#include "[clang/Analysis/CallGraph.h](CallGraph%5F8h%5Fsource.html)"
Public Types | |
---|---|
using | iterator = FunctionMapTy::iterator |
using | const_iterator = FunctionMapTy::const_iterator |
using | nodes_iterator = llvm::SetVector< CallGraphNode * >::iterator |
Iterators through all the nodes of the graph that have no parent. | |
using | const_nodes_iterator = llvm::SetVector< CallGraphNode * >::const_iterator |
Public Member Functions | |
---|---|
CallGraph () | |
~CallGraph () | |
void | addToCallGraph (Decl *D) |
Populate the call graph with the functions in the given declaration. | |
CallGraphNode * | getNode (const Decl *) const |
Lookup the node for the given declaration. | |
CallGraphNode * | getOrInsertNode (Decl *) |
Lookup the node for the given declaration. | |
iterator | begin () |
Iterators through all the elements in the graph. | |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
unsigned | size () const |
Get the number of nodes in the graph. | |
CallGraphNode * | getRoot () const |
Get the virtual root of the graph, all the functions available externally are represented as callees of the node. | |
void | print (raw_ostream &os) const |
void | dump () const |
void | viewGraph () const |
void | addNodesForBlocks (DeclContext *D) |
bool | VisitFunctionDecl (FunctionDecl *FD) override |
Part of recursive declaration visitation. | |
bool | VisitObjCMethodDecl (ObjCMethodDecl *MD) override |
Part of recursive declaration visitation. | |
bool | TraverseStmt (Stmt *S) override |
Recursively visit a statement or expression, by dispatching to Traverse*() based on the argument's dynamic type. | |
![]() |
|
virtual void | anchor () |
virtual | ~DynamicRecursiveASTVisitor ()=default |
virtual bool | TraverseAST (ASTContext &AST) |
Recursively visits an entire AST, starting from the TranslationUnitDecl. | |
virtual bool | TraverseAttr (Attr *At) |
Recursively visit an attribute, by dispatching to Traverse*Attr() based on the argument's dynamic type. | |
virtual bool | TraverseConstructorInitializer (CXXCtorInitializer *Init) |
Recursively visit a constructor initializer. | |
virtual bool | TraverseCXXBaseSpecifier (const CXXBaseSpecifier &Base) |
Recursively visit a base specifier. | |
virtual bool | TraverseDecl (Decl *D) |
Recursively visit a declaration, by dispatching to Traverse*Decl() based on the argument's dynamic type. | |
virtual bool | TraverseDeclarationNameInfo (DeclarationNameInfo NameInfo) |
Recursively visit a name with its location information. | |
virtual bool | TraverseLambdaCapture (LambdaExpr *LE, const LambdaCapture *C, Expr *Init) |
Recursively visit a lambda capture. | |
virtual bool | TraverseNestedNameSpecifier (NestedNameSpecifier *NNS) |
Recursively visit a C++ nested-name-specifier. | |
virtual bool | TraverseNestedNameSpecifierLoc (NestedNameSpecifierLoc NNS) |
Recursively visit a C++ nested-name-specifier with location information. | |
virtual bool | TraverseStmt (Stmt *S) |
Recursively visit a statement or expression, by dispatching to Traverse*() based on the argument's dynamic type. | |
virtual bool | TraverseTemplateArgument (const TemplateArgument &Arg) |
Recursively visit a template argument and dispatch to the appropriate method for the argument type. | |
virtual bool | TraverseTemplateArgumentLoc (const TemplateArgumentLoc &ArgLoc) |
Recursively visit a template argument location and dispatch to the appropriate method for the argument type. | |
bool | TraverseTemplateArguments (ArrayRef< TemplateArgument > Args) |
Recursively visit a set of template arguments. | |
virtual bool | TraverseTemplateName (TemplateName Template) |
Recursively visit a template name and dispatch to the appropriate method. | |
virtual bool | TraverseType (QualType T) |
Recursively visit a type, by dispatching to Traverse*Type() based on the argument's getTypeClass() property. | |
virtual bool | TraverseTypeLoc (TypeLoc TL) |
Recursively visit a type with location, by dispatching to Traverse*TypeLoc() based on the argument type's getTypeClass() property. | |
virtual bool | TraverseObjCProtocolLoc (ObjCProtocolLoc ProtocolLoc) |
Recursively visit an Objective-C protocol reference with location information. | |
virtual bool | TraverseTypeConstraint (const TypeConstraint *C) |
Traverse a concept (requirement). | |
virtual bool | TraverseConceptRequirement (concepts::Requirement *R) |
virtual bool | TraverseConceptTypeRequirement (concepts::TypeRequirement *R) |
virtual bool | TraverseConceptExprRequirement (concepts::ExprRequirement *R) |
virtual bool | TraverseConceptNestedRequirement (concepts::NestedRequirement *R) |
virtual bool | TraverseConceptReference (ConceptReference *CR) |
virtual bool | VisitConceptReference (ConceptReference *CR) |
virtual bool | VisitAttr (Attr *A) |
Visit a node. | |
virtual bool | VisitDecl (Decl *D) |
virtual bool | VisitStmt (Stmt *S) |
virtual bool | VisitType (Type *T) |
virtual bool | VisitTypeLoc (TypeLoc TL) |
bool | WalkUpFromDecl (Decl *D) |
Walk up from a node. | |
bool | WalkUpFromStmt (Stmt *S) |
bool | WalkUpFromType (Type *T) |
bool | WalkUpFromTypeLoc (TypeLoc TL) |
virtual bool | dataTraverseStmtPre (Stmt *S) |
Invoked before visiting a statement or expression via data recursion. | |
virtual bool | dataTraverseStmtPost (Stmt *S) |
Invoked after visiting a statement or expression via data recursion. | |
virtual bool | dataTraverseNode (Stmt *S) |
Static Public Member Functions | |
---|---|
static bool | includeInGraph (const Decl *D) |
Determine if a declaration should be included in the graph. | |
static bool | includeCalleeInGraph (const Decl *D) |
Determine if a declaration should be included in the graph for the purposes of being a callee. | |
Additional Inherited Members | |
---|---|
![]() |
|
bool | ShouldVisitTemplateInstantiations = false |
Whether this visitor should recurse into template instantiations. | |
bool | ShouldWalkTypesOfTypeLocs = true |
Whether this visitor should recurse into the types of TypeLocs. | |
bool | ShouldVisitImplicitCode = false |
Whether this visitor should recurse into implicit code, e.g. | |
bool | ShouldVisitLambdaBody = true |
Whether this visitor should recurse into lambda body. | |
![]() |
|
DynamicRecursiveASTVisitor ()=default | |
DynamicRecursiveASTVisitor (DynamicRecursiveASTVisitor &&)=default | |
DynamicRecursiveASTVisitor (const DynamicRecursiveASTVisitor &)=default | |
DynamicRecursiveASTVisitor & | operator= (DynamicRecursiveASTVisitor &&)=default |
DynamicRecursiveASTVisitor & | operator= (const DynamicRecursiveASTVisitor &)=default |
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.
Definition at line 43 of file CallGraph.h.
◆ const_iterator
◆ const_nodes_iterator
◆ iterator
◆ nodes_iterator
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 102 of file CallGraph.h.
◆ ~CallGraph()
CallGraph::~CallGraph ( ) | default |
---|
◆ addNodesForBlocks()
◆ addToCallGraph()
void clang::CallGraph::addToCallGraph ( Decl * D) | inline |
---|
◆ begin() [1/2]
iterator clang::CallGraph::begin ( ) | inline |
---|
◆ begin() [2/2]
◆ dump()
LLVM_DUMP_METHOD void CallGraph::dump | ( | ) | const |
---|
◆ end() [1/2]
iterator clang::CallGraph::end ( ) | inline |
---|
◆ end() [2/2]
◆ getNode()
Lookup the node for the given declaration.
Definition at line 200 of file CallGraph.cpp.
◆ getOrInsertNode()
◆ getRoot()
◆ includeCalleeInGraph()
bool CallGraph::includeCalleeInGraph ( const Decl * D) | static |
---|
◆ includeInGraph()
bool CallGraph::includeInGraph ( const Decl * D) | static |
---|
◆ print()
void CallGraph::print | ( | raw_ostream & | os | ) | const |
---|
◆ size()
unsigned clang::CallGraph::size ( ) const | inline |
---|
◆ TraverseStmt()
bool clang::CallGraph::TraverseStmt ( Stmt * S) | inlineoverridevirtual |
---|
Recursively visit a statement or expression, by dispatching to Traverse*() based on the argument's dynamic type.
Returns
false if the visitation was terminated early, true otherwise (including when the argument is nullptr).
Reimplemented from clang::DynamicRecursiveASTVisitor.
Definition at line 137 of file CallGraph.h.
◆ viewGraph()
void CallGraph::viewGraph | ( | ) | const |
---|
◆ VisitFunctionDecl()
◆ VisitObjCMethodDecl()
◆ CallGraphNode
The documentation for this class was generated from the following files:
- include/clang/Analysis/CallGraph.h
- lib/Analysis/CallGraph.cpp