retdec
Public Types | Public Member Functions | Protected Member Functions | List of all members
retdec::llvmir2hll::PatternFinderRunner Class Referenceabstract

A base class for all runners of pattern finders. More...

#include <pattern_finder_runner.h>

Inheritance diagram for retdec::llvmir2hll::PatternFinderRunner:
Inheritance graph
[legend]

Public Types

using PatternFinders = std::vector< ShPtr< PatternFinder > >
 A container storing pattern finders. More...
 

Public Member Functions

virtual ~PatternFinderRunner ()=default
 
void run (const PatternFinders &pfs, ShPtr< Module > module)
 Runs all the given pattern finders in pfs on module. More...
 
void run (ShPtr< PatternFinder > pf, ShPtr< Module > module)
 Runs the given pattern finder pf on module. More...
 

Protected Member Functions

virtual void doActionsBeforePatternFinderRuns (ShPtr< PatternFinder > pf)=0
 Performs actions before pattern finder pf runs. More...
 
virtual void doActionsAfterPatternFinderHasRun (ShPtr< PatternFinder > pf, const PatternFinder::Patterns &foundPatterns)=0
 Performs actions after pattern finder pf has run. More...
 

Detailed Description

A base class for all runners of pattern finders.

A concrete runner should

Instances of this class have reference object semantics. The class implements the NVI ("non-virtual interface") pattern.

Member Typedef Documentation

◆ PatternFinders

A container storing pattern finders.

Constructor & Destructor Documentation

◆ ~PatternFinderRunner()

virtual retdec::llvmir2hll::PatternFinderRunner::~PatternFinderRunner ( )
virtualdefault

Member Function Documentation

◆ doActionsAfterPatternFinderHasRun()

virtual void retdec::llvmir2hll::PatternFinderRunner::doActionsAfterPatternFinderHasRun ( ShPtr< PatternFinder pf,
const PatternFinder::Patterns foundPatterns 
)
protectedpure virtual

Performs actions after pattern finder pf has run.

Parameters
[in]pfPattern finder that has run.
[in]foundPatternsThe result of pf->findPatterns(module).

Implemented in retdec::llvmir2hll::NoActionPatternFinderRunner, and retdec::llvmir2hll::CLIPatternFinderRunner.

◆ doActionsBeforePatternFinderRuns()

virtual void retdec::llvmir2hll::PatternFinderRunner::doActionsBeforePatternFinderRuns ( ShPtr< PatternFinder pf)
protectedpure virtual

Performs actions before pattern finder pf runs.

Implemented in retdec::llvmir2hll::NoActionPatternFinderRunner, and retdec::llvmir2hll::CLIPatternFinderRunner.

◆ run() [1/2]

void retdec::llvmir2hll::PatternFinderRunner::run ( const PatternFinders pfs,
ShPtr< Module module 
)

Runs all the given pattern finders in pfs on module.

Parameters
[in]pfsPattern finders to be run.
[in]moduleThe module that is passed to the finders in pfs.

More specifically, it calls run(pf, module) on every pattern finder pf in pfs.

Preconditions
  • module is non-null

◆ run() [2/2]

void retdec::llvmir2hll::PatternFinderRunner::run ( ShPtr< PatternFinder pf,
ShPtr< Module module 
)

Runs the given pattern finder pf on module.

Parameters
[in]pfPattern finder to be run.
[in]moduleThe module that is passed to pf->findPatterns().

More specifically, the following actions are done. (1) Calls doActionsBeforePatternFinderRuns() with pf. (2) Calls pf->findPatterns() and stores the result. (3) Calls doActionsAfterPatternFinderHasRun() with pf and the result from (2).

Preconditions
  • module is non-null

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