MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / bifurcateVariableChanged

Function bifurcateVariableChanged

lib/vf_analyzers.cpp:805–824  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

803static bool bifurcate(const Token* tok, const std::set<nonneg int>& varids, const Settings& settings, int depth = 20);
804
805static bool bifurcateVariableChanged(const Variable* var,
806 const std::set<nonneg int>& varids,
807 const Token* start,
808 const Token* end,
809 const Settings& settings,
810 int depth = 20)
811{
812 bool result = false;
813 const Token* tok = start;
814 while ((tok = findVariableChanged(
815 tok->next(), end, var->isPointer(), var->declarationId(), var->isGlobal(), settings))) {
816 if (Token::Match(tok->astParent(), "%assign%")) {
817 if (!bifurcate(tok->astParent()->astOperand2(), varids, settings, depth - 1))
818 return true;
819 } else {
820 result = true;
821 }
822 }
823 return result;
824}
825
826static bool bifurcate(const Token* tok, const std::set<nonneg int>& varids, const Settings& settings, int depth)
827{

Callers 1

bifurcateFunction · 0.85

Calls 6

findVariableChangedFunction · 0.85
bifurcateFunction · 0.85
nextMethod · 0.80
astParentMethod · 0.80
astOperand2Method · 0.80
isGlobalMethod · 0.45

Tested by

no test coverage detected