Fixed #2491 (Tokenizer::setVarId : wrong handling of function call: 'a(b * c, 1);')
This commit is contained in:
parent
0746c2410a
commit
bc31f317bc
|
@ -3303,7 +3303,7 @@ void Tokenizer::setVarId()
|
||||||
|
|
||||||
// If pattern is "( %type% *|& %var% )" then check if it's a
|
// If pattern is "( %type% *|& %var% )" then check if it's a
|
||||||
// variable declaration or a multiplication / mask
|
// variable declaration or a multiplication / mask
|
||||||
if (Token::Match(tok, "( %type% *|& %var% )") && !tok->next()->isStandardType())
|
if (Token::Match(tok, "( %type% *|& %var% [),]") && !tok->next()->isStandardType())
|
||||||
{
|
{
|
||||||
if (!Token::Match(tok->previous(), "%type%"))
|
if (!Token::Match(tok->previous(), "%type%"))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -2722,6 +2722,7 @@ private:
|
||||||
|
|
||||||
void varidFunctionCall2()
|
void varidFunctionCall2()
|
||||||
{
|
{
|
||||||
|
// #2491
|
||||||
const std::string code("void f(int b) {\n"
|
const std::string code("void f(int b) {\n"
|
||||||
" x(a*b,10);\n"
|
" x(a*b,10);\n"
|
||||||
"}");
|
"}");
|
||||||
|
@ -2730,8 +2731,7 @@ private:
|
||||||
"2: x ( a * b");
|
"2: x ( a * b");
|
||||||
const std::string expected2(" , 10 ) ;\n"
|
const std::string expected2(" , 10 ) ;\n"
|
||||||
"3: }\n");
|
"3: }\n");
|
||||||
TODO_ASSERT_EQUALS(expected1+"@1"+expected2, tokenizeDebugListing(code));
|
ASSERT_EQUALS(expected1+"@1"+expected2, tokenizeDebugListing(code));
|
||||||
ASSERT_EQUALS(expected1+"@2"+expected2, tokenizeDebugListing(code));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void varidFunctionCall3()
|
void varidFunctionCall3()
|
||||||
|
@ -2751,7 +2751,6 @@ private:
|
||||||
ASSERT_EQUALS(expected, tokenizeDebugListing(code));
|
ASSERT_EQUALS(expected, tokenizeDebugListing(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void varidStl()
|
void varidStl()
|
||||||
{
|
{
|
||||||
const std::string actual = tokenizeDebugListing(
|
const std::string actual = tokenizeDebugListing(
|
||||||
|
|
Loading…
Reference in New Issue