Fixed #9689 (setVarId: wrong varid when 'not' is used)
This commit is contained in:
parent
7698de7fd3
commit
47c998e52d
|
@ -3297,7 +3297,7 @@ void Tokenizer::setVarId()
|
|||
|
||||
|
||||
// Variable declarations can't start with "return" etc.
|
||||
#define NOTSTART_C "case", "default", "goto", "NOT", "return", "sizeof", "typedef"
|
||||
#define NOTSTART_C "NOT", "case", "default", "goto", "not", "return", "sizeof", "typedef"
|
||||
static const std::set<std::string> notstart_c = { NOTSTART_C };
|
||||
static const std::set<std::string> notstart_cpp = { NOTSTART_C,
|
||||
"delete", "friend", "new", "throw", "using", "virtual", "explicit", "const_cast", "dynamic_cast", "reinterpret_cast", "static_cast", "template"
|
||||
|
|
|
@ -167,8 +167,8 @@ private:
|
|||
TEST_CASE(varid_trailing_return1); // #8889
|
||||
TEST_CASE(varid_trailing_return2); // #9066
|
||||
TEST_CASE(varid_parameter_pack); // #9383
|
||||
|
||||
TEST_CASE(varid_for_auto_cpp17);
|
||||
TEST_CASE(varid_not); // #9689 'not x'
|
||||
|
||||
TEST_CASE(varidclass1);
|
||||
TEST_CASE(varidclass2);
|
||||
|
@ -2598,6 +2598,16 @@ private:
|
|||
ASSERT_EQUALS(exp1, tokenize(code));
|
||||
}
|
||||
|
||||
void varid_not() { // #9689 'not x'
|
||||
const char code1[] = "void foo(int x) const {\n"
|
||||
" if (not x) {}\n"
|
||||
"}";
|
||||
const char exp1[] = "1: void foo ( int x@1 ) const {\n"
|
||||
"2: if ( not x@1 ) { }\n"
|
||||
"3: }\n";
|
||||
ASSERT_EQUALS(exp1, tokenize(code1));
|
||||
}
|
||||
|
||||
void varidclass1() {
|
||||
const std::string actual = tokenize(
|
||||
"class Fred\n"
|
||||
|
|
Loading…
Reference in New Issue