retdec
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
retdec::llvmir2hll::StmtsPattern Class Reference

A pattern that is composed of zero or more statements. More...

#include <stmts_pattern.h>

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

Public Types

using stmt_iterator = StmtVector::const_iterator
 Iterator over statements. More...
 

Public Member Functions

virtual void print (llvm::raw_ostream &os, const std::string &indentation="") const override
 Prints the pattern to stream os, each line indented with indentation. More...
 
Statement Accessors
bool isEmpty () const
 Returns true if the pattern is empty, false otherwise. More...
 
void addStmt (ShPtr< Statement > stmt)
 Adds a new statement into the pattern. More...
 
StmtVector::size_type getNumOfStmts () const
 Returns the number of statements in the pattern. More...
 
stmt_iterator stmt_begin () const
 Returns an iterator to the first statement in the pattern. More...
 
stmt_iterator stmt_end () const
 Returns an iterator past the last statement in the pattern. More...
 
- Public Member Functions inherited from retdec::llvmir2hll::Pattern
virtual ~Pattern ()=default
 

Static Public Member Functions

static ShPtr< StmtsPatterncreate ()
 Creates an empty pattern. More...
 
static ShPtr< StmtsPatterncreate (ShPtr< Statement > stmt)
 Creates a pattern containing stmt. More...
 

Protected Member Functions

 StmtsPattern ()
 Constructs an empty pattern. More...
 
 StmtsPattern (ShPtr< Statement > stmt)
 Constructs a pattern containing stmt. More...
 
- Protected Member Functions inherited from retdec::llvmir2hll::Pattern
 Pattern ()=default
 

Protected Attributes

StmtVector stmts
 Statements that form the pattern. More...
 

Detailed Description

A pattern that is composed of zero or more statements.

Use create() to create instances of this class.

Member Typedef Documentation

◆ stmt_iterator

using retdec::llvmir2hll::StmtsPattern::stmt_iterator = StmtVector::const_iterator

Iterator over statements.

Constructor & Destructor Documentation

◆ StmtsPattern() [1/2]

retdec::llvmir2hll::StmtsPattern::StmtsPattern ( )
protected

Constructs an empty pattern.

◆ StmtsPattern() [2/2]

retdec::llvmir2hll::StmtsPattern::StmtsPattern ( ShPtr< Statement stmt)
explicitprotected

Constructs a pattern containing stmt.

Member Function Documentation

◆ addStmt()

void retdec::llvmir2hll::StmtsPattern::addStmt ( ShPtr< Statement stmt)

Adds a new statement into the pattern.

Iterators returned by stmt_begin() and stmt_end() may be invalidated after this call.

◆ create() [1/2]

ShPtr< StmtsPattern > retdec::llvmir2hll::StmtsPattern::create ( )
static

Creates an empty pattern.

◆ create() [2/2]

ShPtr< StmtsPattern > retdec::llvmir2hll::StmtsPattern::create ( ShPtr< Statement stmt)
static

Creates a pattern containing stmt.

◆ getNumOfStmts()

StmtVector::size_type retdec::llvmir2hll::StmtsPattern::getNumOfStmts ( ) const

Returns the number of statements in the pattern.

◆ isEmpty()

bool retdec::llvmir2hll::StmtsPattern::isEmpty ( ) const

Returns true if the pattern is empty, false otherwise.

Empty means that the pattern is composed of no statements. This means that isEmpty() returns true if and only if getNumOfStmts() returns a non-zero number.

◆ print()

void retdec::llvmir2hll::StmtsPattern::print ( llvm::raw_ostream &  os,
const std::string &  indentation = "" 
) const
overridevirtual

Prints the pattern to stream os, each line indented with indentation.

The pattern may span over multiple lines. When the pattern is empty, nothing should be printed. If the pattern is non-empty, the output is ended with a new line.

Implements retdec::llvmir2hll::Pattern.

◆ stmt_begin()

StmtsPattern::stmt_iterator retdec::llvmir2hll::StmtsPattern::stmt_begin ( ) const

Returns an iterator to the first statement in the pattern.

The returned iterator is a constant iterator so there is no way of modifying the pattern during iterator.

◆ stmt_end()

StmtsPattern::stmt_iterator retdec::llvmir2hll::StmtsPattern::stmt_end ( ) const

Returns an iterator past the last statement in the pattern.

The returned iterator is a constant iterator so there is no way of modifying the pattern during iterator.

Member Data Documentation

◆ stmts

StmtVector retdec::llvmir2hll::StmtsPattern::stmts
protected

Statements that form the pattern.


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