Refactoring: tokens() changed to const and to return const pointer.
This commit is contained in:
parent
aa579911ab
commit
eb1b0abc1e
|
@ -47,7 +47,7 @@ CheckHeaders::~CheckHeaders()
|
|||
|
||||
void CheckHeaders::WarningHeaderWithImplementation()
|
||||
{
|
||||
for (TOKEN *tok = _tokenizer->tokens(); tok; tok = tok->next)
|
||||
for ( const TOKEN *tok = _tokenizer->tokens(); tok; tok = tok->next)
|
||||
{
|
||||
// Only interested in included file
|
||||
if (tok->FileIndex == 0)
|
||||
|
@ -82,7 +82,7 @@ void CheckHeaders::WarningHeaderWithImplementation()
|
|||
void CheckHeaders::WarningIncludeHeader()
|
||||
{
|
||||
// Including..
|
||||
for (TOKEN *includetok = _tokenizer->tokens(); includetok; includetok = includetok->next)
|
||||
for ( const TOKEN *includetok = _tokenizer->tokens(); includetok; includetok = includetok->next)
|
||||
{
|
||||
if (strcmp(includetok->str, "#include") != 0)
|
||||
continue;
|
||||
|
@ -111,7 +111,7 @@ void CheckHeaders::WarningIncludeHeader()
|
|||
|
||||
// Extract classes and names in the header..
|
||||
int indentlevel = 0;
|
||||
for ( TOKEN *tok1 = _tokenizer->tokens(); tok1; tok1 = tok1->next )
|
||||
for ( const TOKEN *tok1 = _tokenizer->tokens(); tok1; tok1 = tok1->next )
|
||||
{
|
||||
if ( tok1->FileIndex != hfile )
|
||||
continue;
|
||||
|
@ -205,7 +205,7 @@ void CheckHeaders::WarningIncludeHeader()
|
|||
// Check if the extracted names are used...
|
||||
bool Needed = false;
|
||||
bool NeedDeclaration = false;
|
||||
for (TOKEN *tok1 = _tokenizer->tokens(); tok1; tok1 = tok1->next)
|
||||
for ( const TOKEN *tok1 = _tokenizer->tokens(); tok1; tok1 = tok1->next)
|
||||
{
|
||||
if (tok1->FileIndex != includetok->FileIndex)
|
||||
continue;
|
||||
|
|
|
@ -377,7 +377,7 @@ void CheckOther::CheckUnsignedDivision()
|
|||
{
|
||||
// Check for "ivar / uvar" and "uvar / ivar"
|
||||
std::map<std::string, char> varsign;
|
||||
for ( TOKEN *tok = _tokenizer->tokens(); tok; tok = tok->next )
|
||||
for ( const TOKEN *tok = _tokenizer->tokens(); tok; tok = tok->next )
|
||||
{
|
||||
if ( Match(tok, "[{};(,] %type% %var% [;=,)]") )
|
||||
{
|
||||
|
|
|
@ -73,7 +73,7 @@ TOKEN *Tokenizer::_gettok(TOKEN *tok, int index)
|
|||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
TOKEN *Tokenizer::tokens()
|
||||
const TOKEN *Tokenizer::tokens() const
|
||||
{
|
||||
return _tokens;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
const TOKEN *GetFunctionTokenByName( const char funcname[] ) const;
|
||||
void CheckGlobalFunctionUsage(const std::vector<std::string> &filenames);
|
||||
void settings( const Settings &settings );
|
||||
TOKEN *tokens();
|
||||
const TOKEN *tokens() const;
|
||||
private:
|
||||
|
||||
struct DefineSymbol
|
||||
|
|
Loading…
Reference in New Issue