Use var id instead of var name in check stl.
This commit is contained in:
parent
668d4d0fe3
commit
f83554e534
|
@ -112,7 +112,7 @@ void CheckStl::stlOutOfBounds()
|
||||||
if (Token::Match(tok2, "; %var% <= %var% . size ( ) ;"))
|
if (Token::Match(tok2, "; %var% <= %var% . size ( ) ;"))
|
||||||
{
|
{
|
||||||
unsigned int indent2 = 0;
|
unsigned int indent2 = 0;
|
||||||
const std::string num(tok2->strAt(1));
|
unsigned int numId = tok2->tokAt(1)->varId();
|
||||||
unsigned int varId = tok2->tokAt(3)->varId();
|
unsigned int varId = tok2->tokAt(3)->varId();
|
||||||
for (const Token *tok3 = tok2->tokAt(8); tok3; tok3 = tok3->next())
|
for (const Token *tok3 = tok2->tokAt(8); tok3; tok3 = tok3->next())
|
||||||
{
|
{
|
||||||
|
@ -128,8 +128,8 @@ void CheckStl::stlOutOfBounds()
|
||||||
{
|
{
|
||||||
if (Token::simpleMatch(tok3->next(), ". size ( )"))
|
if (Token::simpleMatch(tok3->next(), ". size ( )"))
|
||||||
break;
|
break;
|
||||||
else if (Token::simpleMatch(tok3->next(), ("[ " + num + " ]").c_str()))
|
else if (Token::Match(tok3->next(), "[ %varid% ]", numId))
|
||||||
stlOutOfBoundsError(tok3, num, tok3->str());
|
stlOutOfBoundsError(tok3, tok3->tokAt(2)->str(), tok3->str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue