--debug flag can be used to printout token list (for development purposes)

This commit is contained in:
Reijo Tomperi 2009-03-16 23:31:52 +02:00
parent c413c8d4b3
commit b3dd9e699b
3 changed files with 14 additions and 1 deletions

View File

@ -370,7 +370,7 @@ unsigned int CppCheck::check()
void CppCheck::checkFile(const std::string &code, const char FileName[]) void CppCheck::checkFile(const std::string &code, const char FileName[])
{ {
Tokenizer _tokenizer; Tokenizer _tokenizer(_settings);
// Tokenize the file // Tokenize the file
{ {

View File

@ -41,6 +41,13 @@ Tokenizer::Tokenizer()
_tokensBack = 0; _tokensBack = 0;
} }
Tokenizer::Tokenizer(const Settings &settings)
{
_tokens = 0;
_tokensBack = 0;
_settings = settings;
}
Tokenizer::~Tokenizer() Tokenizer::~Tokenizer()
{ {
DeallocateTokens(); DeallocateTokens();
@ -1240,6 +1247,10 @@ void Tokenizer::simplifyTokenList()
} }
createLinks(); createLinks();
if (_settings._debug)
{
_tokens->printOut();
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@ -38,6 +38,7 @@ private:
public: public:
Tokenizer(); Tokenizer();
Tokenizer(const Settings &settings);
~Tokenizer(); ~Tokenizer();
/** /**
@ -188,6 +189,7 @@ private:
std::map<std::string, unsigned int> _typeSize; std::map<std::string, unsigned int> _typeSize;
std::vector<std::string> _files; std::vector<std::string> _files;
Token *_tokens; Token *_tokens;
Settings _settings;
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------