diff --git a/src/cppcheck.cpp b/src/cppcheck.cpp index decb89dd4..4f7968103 100644 --- a/src/cppcheck.cpp +++ b/src/cppcheck.cpp @@ -370,7 +370,7 @@ unsigned int CppCheck::check() void CppCheck::checkFile(const std::string &code, const char FileName[]) { - Tokenizer _tokenizer; + Tokenizer _tokenizer(_settings); // Tokenize the file { diff --git a/src/tokenize.cpp b/src/tokenize.cpp index caf038eb8..bcd3194c3 100644 --- a/src/tokenize.cpp +++ b/src/tokenize.cpp @@ -41,6 +41,13 @@ Tokenizer::Tokenizer() _tokensBack = 0; } +Tokenizer::Tokenizer(const Settings &settings) +{ + _tokens = 0; + _tokensBack = 0; + _settings = settings; +} + Tokenizer::~Tokenizer() { DeallocateTokens(); @@ -1240,6 +1247,10 @@ void Tokenizer::simplifyTokenList() } createLinks(); + if (_settings._debug) + { + _tokens->printOut(); + } } //--------------------------------------------------------------------------- diff --git a/src/tokenize.h b/src/tokenize.h index d42a61ed7..99ea7e135 100644 --- a/src/tokenize.h +++ b/src/tokenize.h @@ -38,6 +38,7 @@ private: public: Tokenizer(); + Tokenizer(const Settings &settings); ~Tokenizer(); /** @@ -188,6 +189,7 @@ private: std::map _typeSize; std::vector _files; Token *_tokens; + Settings _settings; }; //---------------------------------------------------------------------------