Tokenizer::setVarId: Proper handling of 'void f(struct foobar). Ticket: #4444'
This commit is contained in:
parent
38d1b064e8
commit
9af51a75e6
|
@ -2754,7 +2754,7 @@ void Tokenizer::setVarId()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const Token *tok3 = tok2->next();
|
const Token *tok3 = tok2->next();
|
||||||
if (!tok3->isStandardType() && !setVarIdParseDeclaration(&tok3,variableId,executableScope.top())) {
|
if (!tok3->isStandardType() && !Token::Match(tok3,"struct|union|class %type%") && !setVarIdParseDeclaration(&tok3,variableId,executableScope.top())) {
|
||||||
variableId[tok2->previous()->str()] = ++_varId;
|
variableId[tok2->previous()->str()] = ++_varId;
|
||||||
tok = tok2->previous();
|
tok = tok2->previous();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3749,6 +3749,12 @@ private:
|
||||||
ASSERT_EQUALS(expected, actual);
|
ASSERT_EQUALS(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const std::string actual = tokenizeDebugListing("void f(struct foobar);", false, "test.c");
|
||||||
|
const std::string expected("\n\n##file 0\n"
|
||||||
|
"1: void f ( struct foobar ) ;\n");
|
||||||
|
ASSERT_EQUALS(expected, actual);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void varid_sizeof() {
|
void varid_sizeof() {
|
||||||
|
|
Loading…
Reference in New Issue