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

Method run

lib/valueflow.cpp:7248–7279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7246 }
7247
7248 bool run(std::initializer_list<ValuePtr<ValueFlowPass>> passes) const
7249 {
7250 std::size_t values = 0;
7251 std::size_t n = state.settings.vfOptions.maxIterations;
7252 const bool doProgress = state.settings.reportProgress >= 0;
7253 while (n > 0 && values != getTotalValues()) {
7254 values = getTotalValues();
7255 const std::size_t passnum = state.settings.vfOptions.maxIterations - n + 1;
7256 const std::string passnum_s = std::to_string(passnum);
7257 if (std::any_of(passes.begin(), passes.end(), [&](const ValuePtr<ValueFlowPass>& pass) {
7258 // the string concatination is a hot spot in TestIO::testScanfArgument and TestIO::testPrintfArgumentVariables
7259 std::string stage = doProgress ? std::string("ValueFlow::") + pass->name() + (' ' + passnum_s) : "";
7260 ProgressReporter progressReporter(state.errorLogger, state.settings.reportProgress, state.tokenlist.getSourceFilePath(), std::move(stage));
7261 return run(pass, passnum);
7262 }))
7263 return true;
7264 --n;
7265 }
7266 if (state.settings.debugwarnings) {
7267 if (n == 0 && values != getTotalValues()) {
7268 ErrorMessage::FileLocation loc(state.tokenlist.getFiles()[0], 0, 0);
7269 ErrorMessage errmsg({std::move(loc)},
7270 "",
7271 Severity::debug,
7272 "ValueFlow maximum iterations exceeded",
7273 "valueFlowMaxIterations",
7274 Certainty::normal);
7275 state.errorLogger.reportErr(errmsg);
7276 }
7277 }
7278 return false;
7279 }
7280
7281 bool run(const ValuePtr<ValueFlowPass>& pass, std::size_t it) const
7282 {

Callers 1

setValuesMethod · 0.45

Calls 7

isCPPMethod · 0.80
cppMethod · 0.80
runFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
nameMethod · 0.45
reportErrMethod · 0.45

Tested by

no test coverage detected