Tokenizer::setVarId: Fixed problem with class declarations with inheritance. skip them.
This commit is contained in:
parent
0dd05e0d56
commit
17f891ad34
|
@ -3409,8 +3409,13 @@ void Tokenizer::setVarId()
|
||||||
if (tok->str() == "virtual")
|
if (tok->str() == "virtual")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Token::Match(tok, "class|struct|union %type% :|{|;"))
|
if (Token::Match(tok, "class|struct|union %type% :|{|;")) {
|
||||||
|
if (tok->strAt(2) == ":") {
|
||||||
|
while (tok->next() && !Token::Match(tok->next(),"[;{]"))
|
||||||
|
tok = tok->next();
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
while (Token::Match(tok, "public:|private:|protected:"))
|
while (Token::Match(tok, "public:|private:|protected:"))
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
|
|
@ -193,6 +193,7 @@ private:
|
||||||
TEST_CASE(varid41); // ticket #3340 (varid for union type)
|
TEST_CASE(varid41); // ticket #3340 (varid for union type)
|
||||||
TEST_CASE(varid42); // ticket #3316 (varid for array)
|
TEST_CASE(varid42); // ticket #3316 (varid for array)
|
||||||
TEST_CASE(varid43);
|
TEST_CASE(varid43);
|
||||||
|
TEST_CASE(varid44);
|
||||||
TEST_CASE(varidFunctionCall1);
|
TEST_CASE(varidFunctionCall1);
|
||||||
TEST_CASE(varidFunctionCall2);
|
TEST_CASE(varidFunctionCall2);
|
||||||
TEST_CASE(varidFunctionCall3);
|
TEST_CASE(varidFunctionCall3);
|
||||||
|
@ -3069,6 +3070,13 @@ private:
|
||||||
tokenizeDebugListing(code));
|
tokenizeDebugListing(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void varid44() {
|
||||||
|
const std::string code("class A:public B,public C,public D {};");
|
||||||
|
ASSERT_EQUALS("\n\n##file 0\n"
|
||||||
|
"1: class A : public B , public C , public D { } ;\n",
|
||||||
|
tokenizeDebugListing(code));
|
||||||
|
}
|
||||||
|
|
||||||
void varidFunctionCall1() {
|
void varidFunctionCall1() {
|
||||||
const std::string code("void f() {\n"
|
const std::string code("void f() {\n"
|
||||||
" int x;\n"
|
" int x;\n"
|
||||||
|
|
Loading…
Reference in New Issue