diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 84366838e..9d8b41bed 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -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(); diff --git a/lib/cppcheck.h b/lib/cppcheck.h index 5ef01df1e..60125e484 100644 --- a/lib/cppcheck.h +++ b/lib/cppcheck.h @@ -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; }; /// @}