retdec
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
retdec::llvmir2hll::CG Class Referencefinal

A representation of a call graph (CG). More...

#include <cg.h>

Inheritance diagram for retdec::llvmir2hll::CG:
Inheritance graph
[legend]
Collaboration diagram for retdec::llvmir2hll::CG:
Collaboration graph
[legend]

Classes

class  CalledFuncs
 Information about called functions from a caller. More...
 

Public Types

using CallerCalleeMap = std::map< ShPtr< Function >, ShPtr< CalledFuncs > >
 Mapping of a caller into callees. More...
 
using caller_iterator = CallerCalleeMap::const_iterator
 Callers iterator. More...
 

Public Member Functions

ShPtr< ModulegetCorrespondingModule () const
 Returns the module for which this call graph has been created. More...
 
ShPtr< CalledFuncsgetCalledFuncs (ShPtr< Function > func, bool includeIndirectCalls=false) const
 Returns called functions from the given function. More...
 
Callers Accessors
caller_iterator caller_begin () const
 Returns an iterator to the first caller. More...
 
caller_iterator caller_end () const
 Returns an iterator past the last caller. More...
 

Private Member Functions

 CG (ShPtr< Module > module)
 Constructs a new call graph. More...
 
ShPtr< CalledFuncscomputeIndirectCalls (ShPtr< CalledFuncs > calledFuncs) const
 Computes indirect calls from the given called functions. More...
 
- Private Member Functions inherited from retdec::utils::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 

Private Attributes

ShPtr< Modulemodule
 Module for which this call graph has been created. More...
 
CallerCalleeMap callerCalleeMap
 Mapping of a caller into callees. More...
 

Friends

class CGBuilder
 

Detailed Description

A representation of a call graph (CG).

See http://en.wikipedia.org/wiki/Call_graph.

Use CGBuilder to create instances of this class. Whenever the underlying module is changed in a way that would affect the validity of the generated CG, the CG has to be re-built.

Instances of this class have reference object semantics.

This class is not meant to be subclassed.

Member Typedef Documentation

◆ caller_iterator

using retdec::llvmir2hll::CG::caller_iterator = CallerCalleeMap::const_iterator

Callers iterator.

◆ CallerCalleeMap

Mapping of a caller into callees.

Constructor & Destructor Documentation

◆ CG()

retdec::llvmir2hll::CG::CG ( ShPtr< Module module)
private

Constructs a new call graph.

Parameters
[in]moduleModule for which this call graph is created.

Member Function Documentation

◆ caller_begin()

CG::caller_iterator retdec::llvmir2hll::CG::caller_begin ( ) const

Returns an iterator to the first caller.

◆ caller_end()

CG::caller_iterator retdec::llvmir2hll::CG::caller_end ( ) const

Returns an iterator past the last caller.

◆ computeIndirectCalls()

ShPtr< CG::CalledFuncs > retdec::llvmir2hll::CG::computeIndirectCalls ( ShPtr< CalledFuncs calledFuncs) const
private

Computes indirect calls from the given called functions.

This function doesn't change calledFuncs.

◆ getCalledFuncs()

ShPtr< CG::CalledFuncs > retdec::llvmir2hll::CG::getCalledFuncs ( ShPtr< Function func,
bool  includeIndirectCalls = false 
) const

Returns called functions from the given function.

Parameters
[in]funcFunction for which called functions are obtained.
[in]includeIndirectCallsIf true, also indirect calls are considered, e.g. if func calls foo() and foo() calls bar(), then bar() is included into the result.

If func is a declaration, then the callees data member of the result will be empty.

If func doesn't belong to the underlying module, the null pointer is returned.

◆ getCorrespondingModule()

ShPtr< Module > retdec::llvmir2hll::CG::getCorrespondingModule ( ) const

Returns the module for which this call graph has been created.

Friends And Related Function Documentation

◆ CGBuilder

friend class CGBuilder
friend

Member Data Documentation

◆ callerCalleeMap

CallerCalleeMap retdec::llvmir2hll::CG::callerCalleeMap
private

Mapping of a caller into callees.

◆ module

ShPtr<Module> retdec::llvmir2hll::CG::module
private

Module for which this call graph has been created.


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