CppCheck: Added _simplify flag that can be used by clients to disable simplifications

This commit is contained in:
Daniel Marjamäki 2013-05-11 11:35:04 +02:00
parent b6bcdf2936
commit 2f1050595d
2 changed files with 11 additions and 1 deletions

View File

@ -40,7 +40,7 @@ static const char ExtraVersion[] = "";
static TimerResults S_timerResults;
CppCheck::CppCheck(ErrorLogger &errorLogger, bool useGlobalSuppressions)
: _errorLogger(errorLogger), exitcode(0), _useGlobalSuppressions(useGlobalSuppressions), tooManyConfigs(false)
: _errorLogger(errorLogger), exitcode(0), _useGlobalSuppressions(useGlobalSuppressions), tooManyConfigs(false), _simplify(true)
{
}
@ -338,6 +338,9 @@ void CppCheck::checkFile(const std::string &code, const char FileName[])
if (_settings.isEnabled("unusedFunction") && _settings._jobs == 1)
_checkUnusedFunctions.parseTokens(_tokenizer);
if (!_simplify)
return;
Timer timer3("Tokenizer::simplifyTokenList", _settings._showtime, &S_timerResults);
result = _tokenizer.simplifyTokenList();
timer3.Stop();

View File

@ -133,6 +133,10 @@ public:
void tooManyConfigsError(const std::string &file, const std::size_t numberOfConfigurations);
void dontSimplify() {
_simplify = false;
}
private:
/** @brief There has been a internal error => Report information message */
@ -197,6 +201,9 @@ private:
/** Are there too many configs? */
bool tooManyConfigs;
/** Simplify code? true by default */
bool _simplify;
};
/// @}