Merge pull request #430 from Dmitry-Me/mergeDuplicatePatterns
Merge partially duplicate patterns
This commit is contained in:
commit
210d01c274
|
@ -4955,8 +4955,7 @@ void Tokenizer::simplifyCasts()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace pointer casts of 0.. "(char *)0" => "0"
|
// Replace pointer casts of 0.. "(char *)0" => "0"
|
||||||
while (Token::Match(tok->next(), "( %type% * ) 0") ||
|
while (Token::Match(tok->next(), "( %type% %type%| * ) 0")) {
|
||||||
Token::Match(tok->next(), "( %type% %type% * ) 0")) {
|
|
||||||
Token::eraseTokens(tok, tok->next()->link()->next());
|
Token::eraseTokens(tok, tok->next()->link()->next());
|
||||||
if (tok->str() == ")" && tok->link()->previous()) {
|
if (tok->str() == ")" && tok->link()->previous()) {
|
||||||
// If there was another cast before this, go back
|
// If there was another cast before this, go back
|
||||||
|
@ -5174,10 +5173,8 @@ void Tokenizer:: simplifyFunctionPointers()
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for function pointer cast
|
// check for function pointer cast
|
||||||
if (Token::Match(tok, "( %type% *| *| ( * ) (") ||
|
if (Token::Match(tok, "( %type% %type%| *| *| ( * ) (") ||
|
||||||
Token::Match(tok, "( %type% %type% *| *| ( * ) (") ||
|
Token::Match(tok, "static_cast < %type% %type%| *| *| ( * ) (")) {
|
||||||
Token::Match(tok, "static_cast < %type% *| *| ( * ) (") ||
|
|
||||||
Token::Match(tok, "static_cast < %type% %type% *| *| ( * ) (")) {
|
|
||||||
Token *tok1 = tok;
|
Token *tok1 = tok;
|
||||||
|
|
||||||
if (tok1->str() == "static_cast")
|
if (tok1->str() == "static_cast")
|
||||||
|
|
Loading…
Reference in New Issue