CheckCondition: Moved checks to 'normal'

This commit is contained in:
Daniel Marjamäki 2019-03-09 22:00:59 +01:00
parent ea9b2032c1
commit 4ce6de39c5
2 changed files with 12 additions and 5 deletions

View File

@ -161,6 +161,11 @@ bool CheckCondition::assignIfParseScope(const Token * const assignTok,
if (Token::Match(tok2, "%varid% =", varid)) {
return true;
}
if (bitop == '&' && Token::Match(tok2, "%varid% &= %num% ;", varid)) {
const MathLib::bigint num2 = MathLib::toLongNumber(tok2->strAt(2));
if (0 == (num & num2))
mismatchingBitAndError(assignTok, num, tok2, num2);
}
if (Token::Match(tok2, "++|-- %varid%", varid) || Token::Match(tok2, "%varid% ++|--", varid))
return true;
if (Token::Match(tok2, "[(,] &| %varid% [,)]", varid) && isParameterChanged(tok2))

View File

@ -61,17 +61,19 @@ public:
checkCondition.alwaysTrueFalse();
checkCondition.duplicateCondition();
checkCondition.checkPointerAdditionResultNotNull();
}
/** @brief Run checks against the simplified token list */
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
CheckCondition checkCondition(tokenizer, settings, errorLogger);
checkCondition.assignIf();
checkCondition.checkBadBitmaskCheck();
checkCondition.comparison();
checkCondition.checkModuloAlwaysTrueFalse();
}
/** @brief Run checks against the simplified token list */
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
(void)tokenizer;
(void)settings;
(void)errorLogger;
}
/** mismatching assignment / comparison */
void assignIf();