Fixed #8745 (Syntax error: AST broken (or))
This commit is contained in:
parent
91a8807810
commit
404eb6c746
|
@ -6252,6 +6252,8 @@ bool Tokenizer::simplifyCAlternativeTokens()
|
|||
if (cOpIt != cAlternativeTokens.end()) {
|
||||
if (!Token::Match(tok->previous(), "%name%|%num%|%char%|)|]|> %name% %name%|%num%|%char%|%op%|("))
|
||||
continue;
|
||||
if (Token::Match(tok->next(), "%assign%|%or%|%oror%|&&|*|/|%|^"))
|
||||
continue;
|
||||
tok->str(cOpIt->second);
|
||||
ret = true;
|
||||
} else if (Token::Match(tok, "not|compl")) {
|
||||
|
|
|
@ -5950,6 +5950,8 @@ private:
|
|||
ASSERT_EQUALS("void f ( ) { if ( not = x ) { } }", tokenizeAndStringify("void f() { if (not=x){} }", false, true, Settings::Native, "test.cpp"));
|
||||
// #8029
|
||||
ASSERT_EQUALS("void f ( struct S * s ) { x = s . and + 1 ; }", tokenizeAndStringify("void f(struct S *s) { x = s->and + 1; }", false, true, Settings::Native, "test.c"));
|
||||
// #8745
|
||||
ASSERT_EQUALS("void f ( ) { if ( x ) { or = 0 ; } }", tokenizeAndStringify("void f() { if (x) or = 0; }"));
|
||||
}
|
||||
|
||||
void simplifyCalculations() {
|
||||
|
|
Loading…
Reference in New Issue