Fixed order of simplifications (#6029)
This commit is contained in:
parent
8bbbb54f94
commit
83a80cebeb
|
@ -3167,6 +3167,9 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
|
|||
if (_settings->terminated())
|
||||
return false;
|
||||
|
||||
// Simplify the C alternative tokens (and, or, etc.)
|
||||
simplifyCAlternativeTokens();
|
||||
|
||||
// replace 'NULL' and similar '0'-defined macros with '0'
|
||||
simplifyNull();
|
||||
|
||||
|
@ -3480,9 +3483,6 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
|
|||
// Link < with >
|
||||
createLinks2();
|
||||
|
||||
// Simplify the C alternative tokens (and, or, etc.)
|
||||
simplifyCAlternativeTokens();
|
||||
|
||||
// The simplify enum might have inner loops
|
||||
if (_settings->terminated())
|
||||
return false;
|
||||
|
|
|
@ -2814,7 +2814,7 @@ private:
|
|||
}
|
||||
|
||||
void cAlternativeTokens() {
|
||||
ASSERT_EQUALS("void f ( ) { err |= ( ( r & s ) && ! t ) ; }",
|
||||
ASSERT_EQUALS("void f ( ) { err = err | ( ( r & s ) && ! t ) ; }",
|
||||
tok("void f() { err or_eq ((r bitand s) and not t); }", false));
|
||||
ASSERT_EQUALS("void f ( ) const { r = f ( a [ 4 ] | 15 , ~ c , ! d ) ; }",
|
||||
tok("void f() const { r = f(a[4] bitor 0x0F, compl c, not d) ; }", false));
|
||||
|
|
|
@ -8186,6 +8186,12 @@ private:
|
|||
ASSERT_EQUALS("void f ( ) { if ( ~ b ) { ; } }", tokenizeAndStringify("void f() { if (compl b); }"));
|
||||
ASSERT_EQUALS("void f ( ) { if ( ! b ) { ; } }", tokenizeAndStringify("void f() { if (not b); }"));
|
||||
ASSERT_EQUALS("void f ( ) { if ( a != b ) { ; } }", tokenizeAndStringify("void f() { if (a not_eq b); }"));
|
||||
|
||||
ASSERT_EQUALS("\n" // #6029
|
||||
"\n"
|
||||
"##file 0\n"
|
||||
"1: void f ( bool b@1 ) { if ( ! b@1 ) { ; } }\n",
|
||||
tokenizeDebugListing("void f(bool b) { if (not b); }"));
|
||||
}
|
||||
|
||||
void simplifyCalculations() {
|
||||
|
|
Loading…
Reference in New Issue