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

Method erase

lib/checkstl.cpp:1399–1418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1397}
1398
1399void CheckStlImpl::erase()
1400{
1401 logChecker("CheckStl::erase");
1402
1403 const SymbolDatabase* const symbolDatabase = mTokenizer->getSymbolDatabase();
1404
1405 for (const Scope &scope : symbolDatabase->scopeList) {
1406 if (scope.type == ScopeType::eFor && Token::simpleMatch(scope.classDef, "for (")) {
1407 const Token *tok = scope.classDef->linkAt(1);
1408 if (!Token::Match(tok->tokAt(-3), "; ++| %var% ++| ) {"))
1409 continue;
1410 tok = tok->previous();
1411 if (!tok->isName())
1412 tok = tok->previous();
1413 eraseCheckLoopVar(scope, tok->variable());
1414 } else if (scope.type == ScopeType::eWhile && Token::Match(scope.classDef, "while ( %var% !=")) {
1415 eraseCheckLoopVar(scope, scope.classDef->tokAt(2)->variable());
1416 }
1417 }
1418}
1419
1420void CheckStlImpl::eraseCheckLoopVar(const Scope &scope, const Variable *var)
1421{

Callers 15

objfileFunction · 0.45
getDepsFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
removeFunctionCallsFunction · 0.45
getFunctionNameMethod · 0.45
makeBaseTypeStringFunction · 0.45
eraseFunction · 0.45
findFunctionMethod · 0.45
~TokenAndNameMethod · 0.45

Calls 4

linkAtMethod · 0.80
variableMethod · 0.80
simpleMatchFunction · 0.70
tokAtMethod · 0.45

Tested by 6

checkWithFileInternalMethod · 0.36
checkWithFSInternalMethod · 0.36
unique_errorsMethod · 0.36
unique_errors_2Method · 0.36
purgedConfigurationMethod · 0.36