Tokenizer: Better handling of c alternative tokens in const method
This commit is contained in:
parent
f7bff1a272
commit
f7f26ffe90
|
@ -7093,8 +7093,16 @@ bool Tokenizer::simplifyCAlternativeTokens()
|
|||
|
||||
bool ret = false;
|
||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||
if (tok->str() == ")") {
|
||||
if (const Token *end = isFunctionHead(tok, "{")) {
|
||||
++executableScopeLevel;
|
||||
tok = const_cast<Token *>(end);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (tok->str() == "{") {
|
||||
if (executableScopeLevel > 0 || Token::simpleMatch(tok->previous(), ") {"))
|
||||
if (executableScopeLevel > 0)
|
||||
++executableScopeLevel;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -6183,6 +6183,7 @@ private:
|
|||
ASSERT_EQUALS("void f ( ) { if ( ~ b ) { ; } }", tokenizeAndStringify("void f() { if (compl b); }", false, true, Settings::Native, "test.cpp"));
|
||||
ASSERT_EQUALS("void f ( ) { if ( ! b ) { ; } }", tokenizeAndStringify("void f() { if (not b); }", false, true, Settings::Native, "test.c"));
|
||||
ASSERT_EQUALS("void f ( ) { if ( ! b ) { ; } }", tokenizeAndStringify("void f() { if (not b); }", false, true, Settings::Native, "test.cpp"));
|
||||
ASSERT_EQUALS("void f ( ) const { if ( ! b ) { ; } }", tokenizeAndStringify("void f() const { if (not b); }", false, true, Settings::Native, "test.cpp"));
|
||||
ASSERT_EQUALS("void f ( ) { if ( a != b ) { ; } }", tokenizeAndStringify("void f() { if (a not_eq b); }", false, true, Settings::Native, "test.c"));
|
||||
ASSERT_EQUALS("void f ( ) { if ( a != b ) { ; } }", tokenizeAndStringify("void f() { if (a not_eq b); }", false, true, Settings::Native, "test.cpp"));
|
||||
// #6201
|
||||
|
|
Loading…
Reference in New Issue