Tokenizer::simplifyRedundantParentheses: dont remove parentheses in 'void * operator new(SIZE_TYPE, int);'
This commit is contained in:
parent
e6708c1ae2
commit
dd6ae3033f
|
@ -7162,7 +7162,7 @@ bool Tokenizer::simplifyRedundantParentheses()
|
|||
ret = true;
|
||||
}
|
||||
|
||||
if (isCPP() && Token::simpleMatch(tok->previous(), "new (") && Token::Match(tok->link(), ") [;,{}[]")) {
|
||||
if (isCPP() && Token::Match(tok->tokAt(-2), "[;{}=(] new (") && Token::Match(tok->link(), ") [;,{}[]")) {
|
||||
// Remove the parentheses in "new (type)" constructs
|
||||
tok->link()->deleteThis();
|
||||
tok->deleteThis();
|
||||
|
|
|
@ -3465,6 +3465,12 @@ private:
|
|||
static char exp[] = "list < int > * f [ 1 ] = { new list < int > } ;";
|
||||
ASSERT_EQUALS(exp, tokenizeAndStringify(code));
|
||||
}
|
||||
// don't remove parentheses in operator new overload
|
||||
{
|
||||
static char code[] = "void *operator new(__SIZE_TYPE__, int);";
|
||||
static char exp[] = "void * operatornew ( __SIZE_TYPE__ , int ) ;";
|
||||
ASSERT_EQUALS(exp, tokenizeAndStringify(code));
|
||||
}
|
||||
}
|
||||
|
||||
void tokenize_double() {
|
||||
|
|
Loading…
Reference in New Issue