Cppcheck
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
Analyzer Struct Referenceabstract

#include <analyzer.h>

Inheritance diagram for Analyzer:
ValueFlowAnalyzer MultiValueFlowAnalyzer SingleValueFlowAnalyzer ExpressionAnalyzer ContainerExpressionAnalyzer OppositeExpressionAnalyzer SameExpressionAnalyzer SubExpressionAnalyzer MemberExpressionAnalyzer

Classes

struct  Action
 
struct  Assume
 
struct  Result
 

Public Types

enum class  Terminate {
  None , Bail , Escape , Modified ,
  Inconclusive , Conditional
}
 
enum class  Direction { Forward , Reverse }
 
enum class  Evaluate { Integral , ContainerEmpty }
 

Public Member Functions

virtual Action analyze (const Token *tok, Direction d) const =0
 Analyze a token. More...
 
virtual void update (Token *tok, Action a, Direction d)=0
 Update the state of the value. More...
 
virtual std::vector< MathLib::bigintevaluate (Evaluate e, const Token *tok, const Token *ctx=nullptr) const =0
 Try to evaluate the value of a token(most likely a condition) More...
 
std::vector< MathLib::bigintevaluate (const Token *tok, const Token *ctx=nullptr) const
 
virtual bool lowerToPossible ()=0
 Lower any values to possible. More...
 
virtual bool lowerToInconclusive ()=0
 Lower any values to inconclusive. More...
 
virtual bool updateScope (const Token *endBlock, bool modified) const =0
 If the analysis is unsure whether to update a scope, this will return true if the analysis should bifurcate the scope. More...
 
virtual bool isConditional () const =0
 If the value is conditional. More...
 
virtual bool stopOnCondition (const Token *condTok) const =0
 If analysis should stop on the condition. More...
 
virtual void assume (const Token *tok, bool state, unsigned int flags=0)=0
 The condition that will be assumed during analysis. More...
 
virtual void updateState (const Token *tok)=0
 Update the state of the program at the token. More...
 
virtual ValuePtr< Analyzerreanalyze (Token *tok, const std::string &msg=emptyString) const =0
 Return analyzer for expression at token. More...
 
virtual bool invalid () const
 
virtual ~Analyzer ()=default
 
 Analyzer (const Analyzer &)=default
 

Protected Member Functions

 Analyzer ()=default
 

Detailed Description

Definition at line 32 of file analyzer.h.

Member Enumeration Documentation

◆ Direction

enum Analyzer::Direction
strong
Enumerator
Forward 
Reverse 

Definition at line 149 of file analyzer.h.

◆ Evaluate

enum Analyzer::Evaluate
strong
Enumerator
Integral 
ContainerEmpty 

Definition at line 160 of file analyzer.h.

◆ Terminate

enum Analyzer::Terminate
strong
Enumerator
None 
Bail 
Escape 
Modified 
Inconclusive 
Conditional 

Definition at line 133 of file analyzer.h.

Constructor & Destructor Documentation

◆ ~Analyzer()

virtual Analyzer::~Analyzer ( )
virtualdefault

◆ Analyzer() [1/2]

Analyzer::Analyzer ( const Analyzer )
default

◆ Analyzer() [2/2]

Analyzer::Analyzer ( )
protecteddefault

Member Function Documentation

◆ analyze()

virtual Action Analyzer::analyze ( const Token tok,
Direction  d 
) const
pure virtual

Analyze a token.

Implemented in ValueFlowAnalyzer.

◆ assume()

virtual void Analyzer::assume ( const Token tok,
bool  state,
unsigned int  flags = 0 
)
pure virtual

The condition that will be assumed during analysis.

Implemented in ValueFlowAnalyzer.

◆ evaluate() [1/2]

std::vector<MathLib::bigint> Analyzer::evaluate ( const Token tok,
const Token ctx = nullptr 
) const
inline

Definition at line 168 of file analyzer.h.

References evaluate(), and Integral.

◆ evaluate() [2/2]

virtual std::vector<MathLib::bigint> Analyzer::evaluate ( Evaluate  e,
const Token tok,
const Token ctx = nullptr 
) const
pure virtual

Try to evaluate the value of a token(most likely a condition)

Implemented in ValueFlowAnalyzer.

Referenced by evaluate().

◆ invalid()

virtual bool Analyzer::invalid ( ) const
inlinevirtual

Reimplemented in ExpressionAnalyzer.

Definition at line 188 of file analyzer.h.

Referenced by ValueFlowAnalyzer::analyze().

◆ isConditional()

virtual bool Analyzer::isConditional ( ) const
pure virtual

If the value is conditional.

Implemented in MultiValueFlowAnalyzer, and SingleValueFlowAnalyzer.

◆ lowerToInconclusive()

virtual bool Analyzer::lowerToInconclusive ( )
pure virtual

Lower any values to inconclusive.

Implemented in MultiValueFlowAnalyzer, and SingleValueFlowAnalyzer.

Referenced by ValueFlowAnalyzer::update().

◆ lowerToPossible()

virtual bool Analyzer::lowerToPossible ( )
pure virtual

Lower any values to possible.

Implemented in MultiValueFlowAnalyzer, and SingleValueFlowAnalyzer.

◆ reanalyze()

virtual ValuePtr<Analyzer> Analyzer::reanalyze ( Token tok,
const std::string &  msg = emptyString 
) const
pure virtual

Return analyzer for expression at token.

Implemented in SingleValueFlowAnalyzer, SubExpressionAnalyzer, and ValueFlowAnalyzer.

◆ stopOnCondition()

virtual bool Analyzer::stopOnCondition ( const Token condTok) const
pure virtual

If analysis should stop on the condition.

Implemented in MultiValueFlowAnalyzer, and SingleValueFlowAnalyzer.

◆ update()

virtual void Analyzer::update ( Token tok,
Action  a,
Direction  d 
)
pure virtual

Update the state of the value.

Implemented in ValueFlowAnalyzer.

◆ updateScope()

virtual bool Analyzer::updateScope ( const Token endBlock,
bool  modified 
) const
pure virtual

If the analysis is unsure whether to update a scope, this will return true if the analysis should bifurcate the scope.

Implemented in MultiValueFlowAnalyzer, and SingleValueFlowAnalyzer.

◆ updateState()

virtual void Analyzer::updateState ( const Token tok)
pure virtual

Update the state of the program at the token.

Implemented in ValueFlowAnalyzer.


The documentation for this struct was generated from the following file: