Cppcheck
Public Member Functions | Public Attributes | List of all members
MultiValueFlowAnalyzer Struct Reference
Inheritance diagram for MultiValueFlowAnalyzer:
ValueFlowAnalyzer Analyzer

Public Member Functions

 MultiValueFlowAnalyzer (const std::unordered_map< const Variable *, ValueFlow::Value > &args, const TokenList &t, const Settings &set)
 
virtual const std::unordered_map< nonneg int, const Variable * > & getVars () const
 
const ValueFlow::ValuegetValue (const Token *tok) const override
 
ValueFlow::ValuegetValue (const Token *tok) override
 
void makeConditional () override
 
void addErrorPath (const Token *tok, const std::string &s) override
 
bool isAlias (const Token *tok, bool &inconclusive) const 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...
 
bool match (const Token *tok) const override
 
ProgramState getProgramState () const override
 
- Public Member Functions inherited from ValueFlowAnalyzer
 ValueFlowAnalyzer (const TokenList &t, const Settings &s)
 
virtual bool internalMatch (const Token *) const
 
virtual int getIndirect (const Token *tok) const
 
virtual bool isGlobal () const
 
virtual bool dependsOnThis () const
 
virtual bool isVariable () 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 isAliasModified (const Token *tok, int indirect=-1) 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
 
virtual bool useSymbolicValues () 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...
 
virtual void internalUpdate (Token *, const ValueFlow::Value &, Direction)
 
void update (Token *tok, Action a, Direction d) override
 Update the state of the value. More...
 
ValuePtr< Analyzerreanalyze (Token *, const std::string &) const override
 Return analyzer for expression at token. More...
 
- Public Member Functions inherited from Analyzer
std::vector< MathLib::bigintevaluate (const Token *tok, const Token *ctx=nullptr) const
 
virtual bool invalid () const
 
virtual ~Analyzer ()=default
 
 Analyzer (const Analyzer &)=default
 

Public Attributes

std::unordered_map< nonneg int, ValueFlow::Valuevalues
 
std::unordered_map< nonneg int, const Variable * > vars
 
- Public Attributes inherited from ValueFlowAnalyzer
const TokenListtokenlist
 
const Settingssettings
 
ProgramMemoryState pms
 

Additional Inherited Members

- 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 }
 
- 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 7412 of file valueflow.cpp.

Constructor & Destructor Documentation

◆ MultiValueFlowAnalyzer()

MultiValueFlowAnalyzer::MultiValueFlowAnalyzer ( const std::unordered_map< const Variable *, ValueFlow::Value > &  args,
const TokenList t,
const Settings set 
)
inline

Definition at line 7416 of file valueflow.cpp.

References values, and vars.

Member Function Documentation

◆ addErrorPath()

void MultiValueFlowAnalyzer::addErrorPath ( const Token tok,
const std::string &  s 
)
inlineoverridevirtual

Implements ValueFlowAnalyzer.

Definition at line 7451 of file valueflow.cpp.

References values.

◆ getProgramState()

ProgramState MultiValueFlowAnalyzer::getProgramState ( ) const
inlineoverridevirtual

Implements ValueFlowAnalyzer.

Definition at line 7547 of file valueflow.cpp.

References Variable::nameToken(), values, and vars.

◆ getValue() [1/2]

const ValueFlow::Value* MultiValueFlowAnalyzer::getValue ( const Token tok) const
inlineoverridevirtual

Implements ValueFlowAnalyzer.

Definition at line 7428 of file valueflow.cpp.

References values, and Token::varId().

◆ getValue() [2/2]

ValueFlow::Value* MultiValueFlowAnalyzer::getValue ( const Token tok)
inlineoverridevirtual

Implements ValueFlowAnalyzer.

Definition at line 7436 of file valueflow.cpp.

References values, and Token::varId().

◆ getVars()

virtual const std::unordered_map<nonneg int, const Variable*>& MultiValueFlowAnalyzer::getVars ( ) const
inlinevirtual

Definition at line 7424 of file valueflow.cpp.

References vars.

Referenced by isAlias(), and updateScope().

◆ isAlias()

bool MultiValueFlowAnalyzer::isAlias ( const Token tok,
bool &  inconclusive 
) const
inlineoverridevirtual

Implements ValueFlowAnalyzer.

Definition at line 7457 of file valueflow.cpp.

References getVars(), inconclusive, isAliasOf(), nonneg, values, and Token::varId().

◆ isConditional()

bool MultiValueFlowAnalyzer::isConditional ( ) const
inlineoverridevirtual

If the value is conditional.

Implements Analyzer.

Definition at line 7488 of file valueflow.cpp.

References values.

Referenced by stopOnCondition(), and updateScope().

◆ lowerToInconclusive()

bool MultiValueFlowAnalyzer::lowerToInconclusive ( )
inlineoverridevirtual

Lower any values to inconclusive.

Implements Analyzer.

Definition at line 7479 of file valueflow.cpp.

References values.

◆ lowerToPossible()

bool MultiValueFlowAnalyzer::lowerToPossible ( )
inlineoverridevirtual

Lower any values to possible.

Implements Analyzer.

Definition at line 7471 of file valueflow.cpp.

References values.

◆ makeConditional()

void MultiValueFlowAnalyzer::makeConditional ( )
inlineoverridevirtual

Implements ValueFlowAnalyzer.

Definition at line 7445 of file valueflow.cpp.

References values.

◆ match()

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

Implements ValueFlowAnalyzer.

Definition at line 7543 of file valueflow.cpp.

References values, and Token::varId().

◆ stopOnCondition()

bool MultiValueFlowAnalyzer::stopOnCondition ( const Token condTok) const
inlineoverridevirtual

If analysis should stop on the condition.

Implements Analyzer.

Definition at line 7498 of file valueflow.cpp.

References Token::hasKnownIntValue(), isConditional(), Token::values(), values, and Token::varId().

◆ updateScope()

bool MultiValueFlowAnalyzer::updateScope ( const Token endBlock,
bool  modified 
) const
inlineoverridevirtual

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

Implements Analyzer.

Definition at line 7510 of file valueflow.cpp.

References bifurcate(), Scope::eElse, Scope::eFor, Scope::eIf, Scope::eLambda, Scope::eWhile, getCondTokFromEnd(), ValueFlowAnalyzer::getSettings(), getVars(), isConditional(), ValueFlow::Value::isImpossible(), ValueFlow::Value::isKnown(), ValueFlow::Value::isLifetimeValue(), Token::scope(), Scope::type, and values.

Member Data Documentation

◆ values

std::unordered_map<nonneg int, ValueFlow::Value> MultiValueFlowAnalyzer::values

◆ vars

std::unordered_map<nonneg int, const Variable*> MultiValueFlowAnalyzer::vars

Definition at line 7414 of file valueflow.cpp.

Referenced by getProgramState(), getVars(), and MultiValueFlowAnalyzer().


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