Cppcheck
Public Types | Public Member Functions | Public Attributes | List of all members
SubExpressionAnalyzer Struct Referenceabstract
Inheritance diagram for SubExpressionAnalyzer:
ExpressionAnalyzer SingleValueFlowAnalyzer ValueFlowAnalyzer Analyzer MemberExpressionAnalyzer

Public Types

using PartialReadContainer = std::vector< std::pair< Token *, ValueFlow::Value > >
 
- Public Types inherited from ValueFlowAnalyzer
using ProgramState = ProgramMemory::Map
 
- Public Types inherited from Analyzer
enum class  Terminate {
  None , Bail , Escape , Modified ,
  Inconclusive , Conditional
}
 
enum class  Direction { Forward , Reverse }
 
enum class  Evaluate { Integral , ContainerEmpty }
 

Public Member Functions

 SubExpressionAnalyzer (const Token *e, ValueFlow::Value val, const TokenList &t, const Settings &s)
 
virtual bool submatch (const Token *tok, bool exact=true) const =0
 
bool isAlias (const Token *tok, bool &inconclusive) const override
 
bool match (const Token *tok) const override
 
bool internalMatch (const Token *tok) const override
 
void internalUpdate (Token *tok, const ValueFlow::Value &v, Direction) override
 
ValuePtr< Analyzerreanalyze (Token *, const std::string &) const override
 Return analyzer for expression at token. More...
 
- Public Member Functions inherited from ExpressionAnalyzer
 ExpressionAnalyzer (const Token *e, ValueFlow::Value val, const TokenList &t, const Settings &s)
 
void setupExprVarIds (const Token *start, int depth=0)
 
virtual bool skipUniqueExprIds () const
 
bool invalid () const override
 
ProgramState getProgramState () const override
 
bool dependsOnThis () const override
 
bool isGlobal () const override
 
bool isVariable () const override
 
Action isAliasModified (const Token *tok, int indirect) const override
 
- Public Member Functions inherited from SingleValueFlowAnalyzer
 SingleValueFlowAnalyzer (ValueFlow::Value v, const TokenList &t, const Settings &s)
 
const std::unordered_map< nonneg int, const Variable * > & getVars () const
 
const std::unordered_map< nonneg int, const Variable * > & getAliasedVars () const
 
const ValueFlow::ValuegetValue (const Token *) const override
 
ValueFlow::ValuegetValue (const Token *) override
 
void makeConditional () override
 
bool useSymbolicValues () const override
 
void addErrorPath (const Token *tok, const std::string &s) override
 
bool lowerToPossible () override
 Lower any values to possible. More...
 
bool lowerToInconclusive () override
 Lower any values to inconclusive. More...
 
bool isConditional () const override
 If the value is conditional. More...
 
bool stopOnCondition (const Token *condTok) const override
 If analysis should stop on the condition. More...
 
bool updateScope (const Token *endBlock, bool) const override
 If the analysis is unsure whether to update a scope, this will return true if the analysis should bifurcate the scope. More...
 
- Public Member Functions inherited from ValueFlowAnalyzer
 ValueFlowAnalyzer (const TokenList &t, const Settings &s)
 
virtual int getIndirect (const Token *tok) const
 
bool isCPP () const
 
const SettingsgetSettings () const
 
Action analyzeLifetime (const Token *tok) const
 
std::unordered_map< nonneg int, const Token * > getSymbols (const Token *tok) const
 
ConditionState analyzeCondition (const Token *tok, int depth=20) const
 
virtual Action isModified (const Token *tok) const
 
virtual Action isThisModified (const Token *tok) const
 
Action isGlobalModified (const Token *tok) const
 
virtual Action isWritable (const Token *tok, Direction d) const
 
virtual void writeValue (ValueFlow::Value *value, const Token *tok, Direction d) const
 
const TokenfindMatch (const Token *tok) const
 
bool isSameSymbolicValue (const Token *tok, ValueFlow::Value *value=nullptr) const
 
Action analyzeMatch (const Token *tok, Direction d) const
 
Action analyzeToken (const Token *ref, const Token *tok, Direction d, bool inconclusiveRef) const
 
Action analyze (const Token *tok, Direction d) const override
 Analyze a token. More...
 
template<class F >
std::vector< MathLib::bigintevaluateInt (const Token *tok, F getProgramMemory) const
 
std::vector< MathLib::bigintevaluateInt (const Token *tok) const
 
std::vector< MathLib::bigintevaluate (Evaluate e, const Token *tok, const Token *ctx=nullptr) const override
 Try to evaluate the value of a token(most likely a condition) More...
 
void assume (const Token *tok, bool state, unsigned int flags) override
 The condition that will be assumed during analysis. More...
 
void updateState (const Token *tok) override
 Update the state of the program at the token. More...
 
void update (Token *tok, Action a, Direction d) override
 Update the state of the value. More...
 
- Public Member Functions inherited from Analyzer
std::vector< MathLib::bigintevaluate (const Token *tok, const Token *ctx=nullptr) const
 
virtual ~Analyzer ()=default
 
 Analyzer (const Analyzer &)=default
 

Public Attributes

std::shared_ptr< PartialReadContainerpartialReads
 
- Public Attributes inherited from ExpressionAnalyzer
const Tokenexpr
 
 bool = true
 
bool unknown {}
 
bool dependOnThis {}
 
bool uniqueExprId {}
 
- Public Attributes inherited from SingleValueFlowAnalyzer
std::unordered_map< nonneg int, const Variable * > varids
 
std::unordered_map< nonneg int, const Variable * > aliases
 
ValueFlow::Value value
 
- Public Attributes inherited from ValueFlowAnalyzer
const TokenListtokenlist
 
const Settingssettings
 
ProgramMemoryState pms
 

Additional Inherited Members

- Static Public Member Functions inherited from ExpressionAnalyzer
static bool nonLocal (const Variable *var, bool deref)
 
- Static Public Member Functions inherited from ValueFlowAnalyzer
static const std::string & getAssign (const Token *tok, Direction d)
 
- Protected Member Functions inherited from Analyzer
 Analyzer ()=default
 

Detailed Description

Definition at line 3408 of file valueflow.cpp.

Member Typedef Documentation

◆ PartialReadContainer

Definition at line 3409 of file valueflow.cpp.

Constructor & Destructor Documentation

◆ SubExpressionAnalyzer()

SubExpressionAnalyzer::SubExpressionAnalyzer ( const Token e,
ValueFlow::Value  val,
const TokenList t,
const Settings s 
)
inline

Definition at line 3413 of file valueflow.cpp.

Member Function Documentation

◆ internalMatch()

bool SubExpressionAnalyzer::internalMatch ( const Token tok) const
inlineoverridevirtual

Reimplemented from ValueFlowAnalyzer.

Definition at line 3430 of file valueflow.cpp.

References astIsLHS(), Token::astParent(), ExpressionAnalyzer::expr, Token::exprId(), and submatch().

◆ internalUpdate()

void SubExpressionAnalyzer::internalUpdate ( Token tok,
const ValueFlow::Value v,
Direction   
)
inlineoverridevirtual

Reimplemented from ValueFlowAnalyzer.

Definition at line 3434 of file valueflow.cpp.

References partialReads.

◆ isAlias()

bool SubExpressionAnalyzer::isAlias ( const Token tok,
bool inconclusive 
) const
inlineoverridevirtual

◆ match()

bool SubExpressionAnalyzer::match ( const Token tok) const
inlineoverridevirtual

Reimplemented from ExpressionAnalyzer.

Definition at line 3426 of file valueflow.cpp.

References Token::astOperand1(), ExpressionAnalyzer::expr, Token::exprId(), and submatch().

◆ reanalyze()

ValuePtr<Analyzer> SubExpressionAnalyzer::reanalyze ( Token tok,
const std::string &  msg 
) const
inlineoverridevirtual

Return analyzer for expression at token.

Reimplemented from SingleValueFlowAnalyzer.

Definition at line 3440 of file valueflow.cpp.

◆ submatch()

virtual bool SubExpressionAnalyzer::submatch ( const Token tok,
bool  exact = true 
) const
pure virtual

Implemented in MemberExpressionAnalyzer.

Referenced by internalMatch(), isAlias(), and match().

Member Data Documentation

◆ partialReads

std::shared_ptr<PartialReadContainer> SubExpressionAnalyzer::partialReads

Definition at line 3411 of file valueflow.cpp.

Referenced by internalUpdate(), and valueFlowUninit().


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