Skip to content

Commit ebdcf37

Browse files
committed
tokenize.cpp: small refactoring
1 parent 25fe94e commit ebdcf37

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

lib/tokenize.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2806,19 +2806,6 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration)
28062806
if (!mSettings->buildDir.empty())
28072807
Summaries::create(this, configuration);
28082808

2809-
// TODO: do not run valueflow if no checks are being performed at all - e.g. unusedFunctions only
2810-
const char* disableValueflowEnv = std::getenv("DISABLE_VALUEFLOW");
2811-
const bool doValueFlow = !disableValueflowEnv || (std::strcmp(disableValueflowEnv, "1") != 0);
2812-
2813-
if (doValueFlow) {
2814-
if (mTimerResults) {
2815-
Timer t("Tokenizer::simplifyTokens1::ValueFlow", mSettings->showtime, mTimerResults);
2816-
ValueFlow::setValues(&list, mSymbolDatabase, mErrorLogger, mSettings);
2817-
} else {
2818-
ValueFlow::setValues(&list, mSymbolDatabase, mErrorLogger, mSettings);
2819-
}
2820-
}
2821-
28222809
// Warn about unhandled character literals
28232810
if (mSettings->severity.isEnabled(Severity::portability)) {
28242811
for (const Token *tok = tokens(); tok; tok = tok->next()) {
@@ -2832,7 +2819,18 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration)
28322819
}
28332820
}
28342821

2822+
// TODO: do not run valueflow if no checks are being performed at all - e.g. unusedFunctions only
2823+
const char* disableValueflowEnv = std::getenv("DISABLE_VALUEFLOW");
2824+
const bool doValueFlow = !disableValueflowEnv || (std::strcmp(disableValueflowEnv, "1") != 0);
2825+
28352826
if (doValueFlow) {
2827+
if (mTimerResults) {
2828+
Timer t("Tokenizer::simplifyTokens1::ValueFlow", mSettings->showtime, mTimerResults);
2829+
ValueFlow::setValues(&list, mSymbolDatabase, mErrorLogger, mSettings);
2830+
} else {
2831+
ValueFlow::setValues(&list, mSymbolDatabase, mErrorLogger, mSettings);
2832+
}
2833+
28362834
mSymbolDatabase->setArrayDimensionsUsingValueFlow();
28372835
}
28382836

0 commit comments

Comments
 (0)