Reduce patterns duplication

This commit is contained in:
Dmitry-Me 2014-09-02 19:51:22 +04:00
parent 7342a81ea7
commit 46d24c7bfb
1 changed files with 2 additions and 4 deletions

View File

@ -433,14 +433,12 @@ void CheckOther::invalidPointerCast()
const Token* toTok = 0; const Token* toTok = 0;
const Token* nextTok = 0; const Token* nextTok = 0;
// Find cast // Find cast
if (Token::Match(tok, "( const| %type% const| * )") || if (Token::Match(tok, "( const| %type% %type%| const| * )")) {
Token::Match(tok, "( const| %type% %type% const| * )")) {
toTok = tok->next(); toTok = tok->next();
nextTok = tok->link()->next(); nextTok = tok->link()->next();
if (nextTok && nextTok->str() == "(") if (nextTok && nextTok->str() == "(")
nextTok = nextTok->next(); nextTok = nextTok->next();
} else if (Token::Match(tok, "reinterpret_cast < const| %type% const| * > (") || } else if (Token::Match(tok, "reinterpret_cast < const| %type% %type%| const| * > (")) {
Token::Match(tok, "reinterpret_cast < const| %type% %type% const| * > (")) {
nextTok = tok->tokAt(5); nextTok = tok->tokAt(5);
while (nextTok->str() != "(") while (nextTok->str() != "(")
nextTok = nextTok->next(); nextTok = nextTok->next();