Add --experimental-fast option

This commit is contained in:
Daniel Marjamäki 2019-02-09 14:40:50 +01:00
parent 10d3b2466b
commit 4f232e41dd
4 changed files with 19 additions and 6 deletions

View File

@ -159,6 +159,11 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
else if (std::strncmp(argv[i], "--max-ctu-depth=", 16) == 0)
mSettings->maxCtuDepth = std::atoi(argv[i] + 16);
else if (std::strcmp(argv[i], "--experimental-fast") == 0)
// Skip slow simplifications and see how that affect the results, the
// goal is to remove the simplifications.
mSettings->experimentalFast = true;
// (Experimental) exception handling inside cppcheck client
else if (std::strcmp(argv[i], "--exception-handling") == 0)
mSettings->exceptionHandling = true;

View File

@ -436,12 +436,14 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
// simplify more if required, skip rest of iteration if failed
if (mSimplify) {
// if further simplification fails then skip rest of iteration
Timer timer3("Tokenizer::simplifyTokenList2", mSettings.showtime, &S_timerResults);
result = mTokenizer.simplifyTokenList2();
timer3.Stop();
if (!result)
continue;
if (!mSettings.experimentalFast) {
// if further simplification fails then skip rest of iteration
Timer timer3("Tokenizer::simplifyTokenList2", mSettings.showtime, &S_timerResults);
result = mTokenizer.simplifyTokenList2();
timer3.Stop();
if (!result)
continue;
}
// Check simplified tokens
checkSimplifiedTokens(mTokenizer);

View File

@ -34,6 +34,7 @@ Settings::Settings()
jointSuppressionReport(false),
maxCtuDepth(2),
experimental(false),
experimentalFast(false),
quiet(false),
inlineSuppressions(false),
verbose(false),

View File

@ -111,6 +111,11 @@ public:
*/
bool experimental;
/** Experimental "fast" checking. We skip slow simplifications. The
* goal is that there will not be significant effect on the results
* and that we can remove the slow simplifications. */
bool experimentalFast;
/** @brief Is --quiet given? */
bool quiet;