Tokenizer::simplifyCasts: don't simplify 'f((double)(v1)*v2)' to 'f(*v2)'
This commit is contained in:
parent
2ba2a4e6ae
commit
0705dbd34a
|
@ -4765,7 +4765,7 @@ void Tokenizer::simplifyCasts()
|
|||
tok = tok->linkAt(2);
|
||||
continue;
|
||||
}
|
||||
while (Token::Match(tok->next(), "( %type% *| *| *| ) *|&| %var%") ||
|
||||
while ((Token::Match(tok->next(), "( %type% *| *| *| ) *|&| %var%") && (tok->str() != ")" || tok->tokAt(2)->isStandardType())) ||
|
||||
Token::Match(tok->next(), "( %type% %type% *| *| *| ) *|&| %var%") ||
|
||||
(!tok->isName() && (Token::Match(tok->next(), "( %type% * *| *| ) (") ||
|
||||
Token::Match(tok->next(), "( %type% %type% * *| *| ) (")))) {
|
||||
|
|
|
@ -73,6 +73,7 @@ private:
|
|||
TEST_CASE(removeCast6);
|
||||
TEST_CASE(removeCast7);
|
||||
TEST_CASE(removeCast8);
|
||||
TEST_CASE(removeCast9);
|
||||
|
||||
TEST_CASE(inlineasm);
|
||||
|
||||
|
@ -775,6 +776,10 @@ private:
|
|||
ASSERT_EQUALS("ptr1 = ptr2", tokenizeAndStringify("ptr1=(int * **)ptr2", true));
|
||||
}
|
||||
|
||||
void removeCast9() {
|
||||
ASSERT_EQUALS("f ( ( double ) v1 * v2 )", tokenizeAndStringify("f((double)(v1)*v2)", true));
|
||||
}
|
||||
|
||||
void inlineasm() {
|
||||
ASSERT_EQUALS("asm ( \"mov ax , bx\" ) ;", tokenizeAndStringify("asm { mov ax,bx };"));
|
||||
ASSERT_EQUALS("asm ( \"mov ax , bx\" ) ;", tokenizeAndStringify("_asm { mov ax,bx };"));
|
||||
|
|
Loading…
Reference in New Issue