src/checkstl.cpp(iterators): some corrections.

Corrections for my changes in 12ca70fe5a
and 347802f819 commits.
This commit is contained in:
Slava Semushin 2009-08-01 21:37:24 +07:00
parent 0e2273833e
commit 3158e32b7c
1 changed files with 4 additions and 4 deletions

View File

@ -64,7 +64,7 @@ void CheckStl::iterators()
if (Token::Match(tok2, "%varid% != %var% . end ( )", iteratorId) && tok2->tokAt(2)->varId() != containerId) if (Token::Match(tok2, "%varid% != %var% . end ( )", iteratorId) && tok2->tokAt(2)->varId() != containerId)
{ {
iteratorsError(tok2, tok->strAt(2), tok2->strAt(2)); iteratorsError(tok2, tok->strAt(2), tok2->strAt(2));
tok2 = tok2->tokAt(7); tok2 = tok2->tokAt(6);
} }
else if (Token::Match(tok2, "%var% . insert|erase ( %varid%", iteratorId)) else if (Token::Match(tok2, "%var% . insert|erase ( %varid%", iteratorId))
{ {
@ -73,17 +73,17 @@ void CheckStl::iterators()
else if (tok2->strAt(2) == std::string("erase")) else if (tok2->strAt(2) == std::string("erase"))
validIterator = false; validIterator = false;
tok2 = tok2->tokAt(5); tok2 = tok2->tokAt(4);
} }
else if (!validIterator && Token::Match(tok2, "* %varid%", iteratorId)) else if (!validIterator && Token::Match(tok2, "* %varid%", iteratorId))
{ {
dereferenceErasedError(tok2, tok2->strAt(1)); dereferenceErasedError(tok2, tok2->strAt(1));
tok2 = tok2->tokAt(2); tok2 = tok2->next();
} }
else if (!validIterator && Token::Match(tok2, "%varid% . %var%", iteratorId)) else if (!validIterator && Token::Match(tok2, "%varid% . %var%", iteratorId))
{ {
dereferenceErasedError(tok2, tok2->strAt(0)); dereferenceErasedError(tok2, tok2->strAt(0));
tok2 = tok2->tokAt(3); tok2 = tok2->tokAt(2);
} }
} }
} }