Fixed #9920 (Tokenizer: The keyword is not replaced, leads to false positive)
This commit is contained in:
parent
84b8f32fd4
commit
fa42d8c49c
|
@ -7171,7 +7171,7 @@ bool Tokenizer::simplifyCAlternativeTokens()
|
||||||
if (cOpIt != cAlternativeTokens.end()) {
|
if (cOpIt != cAlternativeTokens.end()) {
|
||||||
if (!Token::Match(tok->previous(), "%name%|%num%|%char%|)|]|> %name% %name%|%num%|%char%|%op%|("))
|
if (!Token::Match(tok->previous(), "%name%|%num%|%char%|)|]|> %name% %name%|%num%|%char%|%op%|("))
|
||||||
continue;
|
continue;
|
||||||
if (Token::Match(tok->next(), "%assign%|%or%|%oror%|&&|*|/|%|^") && !Token::Match(tok->previous(), "%num%|%char% %name% *"))
|
if (Token::Match(tok->next(), "%assign%|%or%|%oror%|&&|*|/|%|^") && !Token::Match(tok->previous(), "%num%|%char%|) %name% *"))
|
||||||
continue;
|
continue;
|
||||||
if (executableScopeLevel == 0 && Token::Match(tok, "%name% (")) {
|
if (executableScopeLevel == 0 && Token::Match(tok, "%name% (")) {
|
||||||
const Token *start = tok;
|
const Token *start = tok;
|
||||||
|
|
|
@ -6223,6 +6223,8 @@ private:
|
||||||
// #9324
|
// #9324
|
||||||
ASSERT_EQUALS("void f ( const char * str ) { while ( * str == '!' || * str == '[' ) { } }",
|
ASSERT_EQUALS("void f ( const char * str ) { while ( * str == '!' || * str == '[' ) { } }",
|
||||||
tokenizeAndStringify("void f(const char *str) { while (*str=='!' or *str=='['){} }"));
|
tokenizeAndStringify("void f(const char *str) { while (*str=='!' or *str=='['){} }"));
|
||||||
|
// #9920
|
||||||
|
ASSERT_EQUALS("result = ch != s . end ( ) && * ch == ':' ;", tokenizeAndStringify("result = ch != s.end() and *ch == ':';", false, true, Settings::Native, "test.c"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyCalculations() {
|
void simplifyCalculations() {
|
||||||
|
|
Loading…
Reference in New Issue