Skip to content

Commit

Permalink
tokenize.cpp: small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Sep 29, 2022
1 parent 2cd1e14 commit 3c6c383
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2806,19 +2806,6 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration)
if (!mSettings->buildDir.empty())
Summaries::create(this, configuration);

// TODO: do not run valueflow if no checks are being performed at all - e.g. unusedFunctions only
const char* disableValueflowEnv = std::getenv("DISABLE_VALUEFLOW");
const bool doValueFlow = !disableValueflowEnv || (std::strcmp(disableValueflowEnv, "1") != 0);

if (doValueFlow) {
if (mTimerResults) {
Timer t("Tokenizer::simplifyTokens1::ValueFlow", mSettings->showtime, mTimerResults);
ValueFlow::setValues(&list, mSymbolDatabase, mErrorLogger, mSettings);
} else {
ValueFlow::setValues(&list, mSymbolDatabase, mErrorLogger, mSettings);
}
}

// Warn about unhandled character literals
if (mSettings->severity.isEnabled(Severity::portability)) {
for (const Token *tok = tokens(); tok; tok = tok->next()) {
Expand All @@ -2832,7 +2819,18 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration)
}
}

// TODO: do not run valueflow if no checks are being performed at all - e.g. unusedFunctions only
const char* disableValueflowEnv = std::getenv("DISABLE_VALUEFLOW");
const bool doValueFlow = !disableValueflowEnv || (std::strcmp(disableValueflowEnv, "1") != 0);

if (doValueFlow) {
if (mTimerResults) {
Timer t("Tokenizer::simplifyTokens1::ValueFlow", mSettings->showtime, mTimerResults);
ValueFlow::setValues(&list, mSymbolDatabase, mErrorLogger, mSettings);
} else {
ValueFlow::setValues(&list, mSymbolDatabase, mErrorLogger, mSettings);
}

mSymbolDatabase->setArrayDimensionsUsingValueFlow();
}

Expand Down

0 comments on commit 3c6c383

Please sign in to comment.