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

Method checkIncrementBoolean

lib/checkbool.cpp:46–61  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

44
45//---------------------------------------------------------------------------
46void CheckBoolImpl::checkIncrementBoolean()
47{
48 if (!mSettings.severity.isEnabled(Severity::style) && !mSettings.isPremiumEnabled("incrementboolean"))
49 return;
50
51 logChecker("CheckBool::checkIncrementBoolean"); // style
52
53 const SymbolDatabase *symbolDatabase = mTokenizer->getSymbolDatabase();
54 for (const Scope * scope : symbolDatabase->functionScopes) {
55 for (const Token* tok = scope->bodyStart->next(); tok != scope->bodyEnd; tok = tok->next()) {
56 if (astIsBool(tok) && tok->astParent() && tok->astParent()->str() == "++") {
57 incrementBooleanError(tok);
58 }
59 }
60 }
61}
62
63void CheckBoolImpl::incrementBooleanError(const Token *tok)
64{

Callers 1

runChecksMethod · 0.80

Calls 6

astIsBoolFunction · 0.85
isPremiumEnabledMethod · 0.80
nextMethod · 0.80
astParentMethod · 0.80
isEnabledMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected