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

Method updateScope

lib/vf_analyzers.cpp:1213–1234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1211 }
1212
1213 bool updateScope(const Token* endBlock, bool /*modified*/) const override {
1214 const Scope* scope = endBlock->scope();
1215 if (!scope)
1216 return false;
1217 if (scope->type == ScopeType::eLambda)
1218 return value.isLifetimeValue();
1219 if (scope->type == ScopeType::eIf || scope->type == ScopeType::eElse || scope->type == ScopeType::eWhile ||
1220 scope->type == ScopeType::eFor) {
1221 if (value.isKnown() || value.isImpossible())
1222 return true;
1223 if (value.isLifetimeValue())
1224 return true;
1225 if (isConditional())
1226 return false;
1227 const Token* condTok = getCondTokFromEnd(endBlock);
1228 std::set<nonneg int> varids2;
1229 std::transform(getVars().cbegin(), getVars().cend(), std::inserter(varids2, varids2.begin()), SelectMapKeys{});
1230 return bifurcate(condTok, varids2, getSettings());
1231 }
1232
1233 return false;
1234 }
1235
1236private:
1237 ValuePtr<Analyzer> reanalyze(Token* tok, const std::string& msg) const override {

Callers

nothing calls this directly

Calls 6

getCondTokFromEndFunction · 0.85
bifurcateFunction · 0.85
scopeMethod · 0.80
isKnownMethod · 0.80
isImpossibleMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected