expose number of variables found by Tokenizer

This commit is contained in:
Robert Reif 2011-02-26 08:42:19 -05:00
parent a80a38e25c
commit 3529014924
2 changed files with 19 additions and 1 deletions

View File

@ -58,6 +58,9 @@ Tokenizer::Tokenizer()
// symbol database
_symbolDatabase = NULL;
// variable count
_varId = 0;
}
Tokenizer::Tokenizer(const Settings *settings, ErrorLogger *errorLogger)
@ -75,6 +78,9 @@ Tokenizer::Tokenizer(const Settings *settings, ErrorLogger *errorLogger)
// symbol database
_symbolDatabase = NULL;
// variable count
_varId = 0;
}
Tokenizer::~Tokenizer()
@ -3271,7 +3277,7 @@ void Tokenizer::setVarId()
tok->varId(0);
// Set variable ids..
unsigned int _varId = 0;
_varId = 0;
for (Token *tok = _tokens; tok; tok = tok->next())
{
if (tok != _tokens && !Token::Match(tok, "[;{}(,] %type%"))

View File

@ -650,6 +650,15 @@ public:
Token *deleteInvalidTypedef(Token *typeDef);
/**
* Get variable count.
* @return number of variables
*/
unsigned int varIdCount() const
{
return _varId;
}
private:
/** Disable copy constructor, no implementation */
Tokenizer(const Tokenizer &);
@ -684,6 +693,9 @@ private:
/** Symbol database that all checks etc can use */
mutable SymbolDatabase *_symbolDatabase;
/** variable count */
unsigned int _varId;
};
/// @}