Tokenizer::setVarId: fixed 'using' bug

This commit is contained in:
Daniel Marjamäki 2011-11-21 18:04:42 +01:00
parent 648fcb9e42
commit 9aa8a49677
2 changed files with 12 additions and 0 deletions

View File

@ -3425,6 +3425,10 @@ void Tokenizer::setVarId()
continue;
}
if (tok->str() == "using") {
continue;
}
if (Token::Match(tok, "goto %any% ;"))
continue;

View File

@ -192,6 +192,7 @@ private:
TEST_CASE(varid40); // ticket #3279
TEST_CASE(varid41); // ticket #3340 (varid for union type)
TEST_CASE(varid42); // ticket #3316 (varid for array)
TEST_CASE(varid43);
TEST_CASE(varidFunctionCall1);
TEST_CASE(varidFunctionCall2);
TEST_CASE(varidFunctionCall3);
@ -3061,6 +3062,13 @@ private:
tokenizeDebugListing(code));
}
void varid43() {
const std::string code("namespace fruit { using banana; }");
ASSERT_EQUALS("\n\n##file 0\n"
"1: namespace fruit { using banana ; }\n",
tokenizeDebugListing(code));
}
void varidFunctionCall1() {
const std::string code("void f() {\n"
" int x;\n"