Refactorizations:
- Removed some duplicate nullpointer checks - Simplified tok->link() on '<' usage.
This commit is contained in:
parent
65916e027c
commit
b162560755
|
@ -8613,11 +8613,8 @@ void Tokenizer::simplifyComma()
|
|||
}
|
||||
|
||||
// Skip unhandled template specifiers..
|
||||
if (Token::Match(tok, "%var% <")) {
|
||||
Token* tok2 = tok->next()->link();
|
||||
if (tok2)
|
||||
tok = tok2;
|
||||
}
|
||||
if (tok->link() && tok->str() == "<")
|
||||
tok = tok->link();
|
||||
|
||||
if (!tok->next() || tok->str() != ",")
|
||||
continue;
|
||||
|
@ -8629,13 +8626,12 @@ void Tokenizer::simplifyComma()
|
|||
tok->str(";");
|
||||
}
|
||||
|
||||
if (tok->previous() && tok->tokAt(-2)) {
|
||||
if (Token::Match(tok->tokAt(-2), "delete %var% , %var% ;") &&
|
||||
tok->next()->varId() != 0) {
|
||||
// Handle "delete a, b;"
|
||||
tok->str(";");
|
||||
tok->insertToken("delete");
|
||||
} else {
|
||||
} else if (tok->tokAt(-2)) {
|
||||
bool replace = false;
|
||||
for (Token *tok2 = tok->previous(); tok2; tok2 = tok2->previous()) {
|
||||
if (tok2->str() == "=") {
|
||||
|
@ -8652,7 +8648,6 @@ void Tokenizer::simplifyComma()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool inReturn = false;
|
||||
Token *startFrom = nullptr; // "[;{}]" token before "return"
|
||||
|
@ -9773,7 +9768,7 @@ void Tokenizer::simplifyMicrosoftStringFunctions()
|
|||
tok->deleteNext();
|
||||
tok->deleteThis();
|
||||
tok->deleteNext();
|
||||
while (tok->next() && Token::Match(tok->next(), "_T ( %char%|%str% )")) {
|
||||
while (Token::Match(tok->next(), "_T ( %char%|%str% )")) {
|
||||
tok->next()->deleteNext();
|
||||
tok->next()->deleteThis();
|
||||
tok->next()->deleteNext();
|
||||
|
@ -9886,7 +9881,7 @@ void Tokenizer::simplifyMicrosoftStringFunctions()
|
|||
tok->deleteThis();
|
||||
tok->deleteNext();
|
||||
tok->isLong(true);
|
||||
while (tok->next() && Token::Match(tok->next(), "_T ( %char%|%str% )")) {
|
||||
while (Token::Match(tok->next(), "_T ( %char%|%str% )")) {
|
||||
tok->next()->deleteNext();
|
||||
tok->next()->deleteThis();
|
||||
tok->next()->deleteNext();
|
||||
|
|
Loading…
Reference in New Issue