varid: don't generate varid and symboldatabase variable for function call parameter
This commit is contained in:
parent
17aaecbd6b
commit
4558701c08
|
@ -3249,7 +3249,7 @@ static const Token* skipScopeIdentifiers(const Token* tok)
|
||||||
|
|
||||||
static const Token* skipPointers(const Token* tok)
|
static const Token* skipPointers(const Token* tok)
|
||||||
{
|
{
|
||||||
while (Token::Match(tok, "*|&|&&") || (tok && tok->str() == "(" && Token::Match(tok->link()->next(), "(|["))) {
|
while (Token::Match(tok, "*|&|&&") || (Token::Match(tok, "( [*&]") && Token::Match(tok->link()->next(), "(|["))) {
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
if (tok->strAt(-1) == "(" && Token::Match(tok, "%type% ::"))
|
if (tok->strAt(-1) == "(" && Token::Match(tok, "%type% ::"))
|
||||||
tok = tok->tokAt(2);
|
tok = tok->tokAt(2);
|
||||||
|
|
|
@ -2320,7 +2320,7 @@ static bool setVarIdParseDeclaration(const Token **tok, const std::map<std::stri
|
||||||
singleNameCount = 1;
|
singleNameCount = 1;
|
||||||
} else if (Token::Match(tok2, "&|&&")) {
|
} else if (Token::Match(tok2, "&|&&")) {
|
||||||
ref = !bracket;
|
ref = !bracket;
|
||||||
} else if (singleNameCount == 1 && tok2->str() == "(" && Token::Match(tok2->link()->next(), "(|[")) {
|
} else if (singleNameCount == 1 && Token::Match(tok2, "( [*&]") && Token::Match(tok2->link()->next(), "(|[")) {
|
||||||
bracket = true; // Skip: Seems to be valid pointer to array or function pointer
|
bracket = true; // Skip: Seems to be valid pointer to array or function pointer
|
||||||
} else if (tok2->str() == "::") {
|
} else if (tok2->str() == "::") {
|
||||||
singleNameCount = 0;
|
singleNameCount = 0;
|
||||||
|
|
|
@ -1144,7 +1144,7 @@ private:
|
||||||
"void(*p2)(char); \n" // pointer to function (char) returning void
|
"void(*p2)(char); \n" // pointer to function (char) returning void
|
||||||
"int(*(*p3)(char))[10];\n" // pointer to function (char) returning pointer to array 10 of int
|
"int(*(*p3)(char))[10];\n" // pointer to function (char) returning pointer to array 10 of int
|
||||||
"float(*(*p4)(char))(long); \n" // pointer to function (char) returning pointer to function (long) returning float
|
"float(*(*p4)(char))(long); \n" // pointer to function (char) returning pointer to function (long) returning float
|
||||||
"short(*(*(p5) (char))(long))(double); \n" // pointer to function (char) returning pointer to function (long) returning pointer to function (double) returning short
|
"short(*(*(*p5) (char))(long))(double);\n" // pointer to function (char) returning pointer to function (long) returning pointer to function (double) returning short
|
||||||
"int(*a1[10])(void); \n" // array 10 of pointer to function (void) returning int
|
"int(*a1[10])(void); \n" // array 10 of pointer to function (void) returning int
|
||||||
"float(*(*a2[10])(char))(long);\n" // array 10 of pointer to func (char) returning pointer to func (long) returning float
|
"float(*(*a2[10])(char))(long);\n" // array 10 of pointer to func (char) returning pointer to func (long) returning float
|
||||||
"short(*(*(*a3[10])(char))(long))(double);\n" // array 10 of pointer to function (char) returning pointer to function (long) returning pointer to function (double) returning short
|
"short(*(*(*a3[10])(char))(long))(double);\n" // array 10 of pointer to function (char) returning pointer to function (long) returning pointer to function (double) returning short
|
||||||
|
|
|
@ -91,6 +91,7 @@ private:
|
||||||
TEST_CASE(varidFunctionCall2);
|
TEST_CASE(varidFunctionCall2);
|
||||||
TEST_CASE(varidFunctionCall3);
|
TEST_CASE(varidFunctionCall3);
|
||||||
TEST_CASE(varidFunctionCall4); // ticket #3280
|
TEST_CASE(varidFunctionCall4); // ticket #3280
|
||||||
|
TEST_CASE(varidFunctionCall5);
|
||||||
TEST_CASE(varidStl);
|
TEST_CASE(varidStl);
|
||||||
TEST_CASE(varid_newauto); // not declaration: new const auto(0);
|
TEST_CASE(varid_newauto); // not declaration: new const auto(0);
|
||||||
TEST_CASE(varid_delete);
|
TEST_CASE(varid_delete);
|
||||||
|
@ -1111,6 +1112,11 @@ private:
|
||||||
tokenize(code2, false, "test.c"));
|
tokenize(code2, false, "test.c"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void varidFunctionCall5() {
|
||||||
|
const char code[] = "void foo() { (f(x[2]))(x[2]); }";
|
||||||
|
ASSERT_EQUALS("1: void foo ( ) { f ( x [ 2 ] ) ( x [ 2 ] ) ; }\n",
|
||||||
|
tokenize(code, false, "test.c"));
|
||||||
|
}
|
||||||
|
|
||||||
void varidStl() {
|
void varidStl() {
|
||||||
const std::string actual = tokenize(
|
const std::string actual = tokenize(
|
||||||
|
|
Loading…
Reference in New Issue