Tokenizer::setVarId : don't give operator function variable id 'operator new []('. Ticket: #1997
This commit is contained in:
parent
fbe11b9bb9
commit
513826d8c2
|
@ -3034,6 +3034,9 @@ void Tokenizer::setVarId()
|
||||||
if (varname == "operator" && Token::Match(tok2, "=|+|-|*|/|[| ]| ("))
|
if (varname == "operator" && Token::Match(tok2, "=|+|-|*|/|[| ]| ("))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (varname == "new" && Token::Match(tok2->tokAt(-2), "operator new (|["))
|
||||||
|
continue;
|
||||||
|
|
||||||
// Is it a function?
|
// Is it a function?
|
||||||
if (tok2->str() == "(")
|
if (tok2->str() == "(")
|
||||||
{
|
{
|
||||||
|
|
|
@ -2450,10 +2450,8 @@ private:
|
||||||
void varid26()
|
void varid26()
|
||||||
{
|
{
|
||||||
const std::string code("list<int (*)()> functions;\n");
|
const std::string code("list<int (*)()> functions;\n");
|
||||||
|
|
||||||
const std::string expected("\n\n##file 0\n"
|
const std::string expected("\n\n##file 0\n"
|
||||||
"1: list < int ( * ) ( ) > functions@1 ;\n");
|
"1: list < int ( * ) ( ) > functions@1 ;\n");
|
||||||
|
|
||||||
ASSERT_EQUALS(expected, tokenizeDebugListing(code));
|
ASSERT_EQUALS(expected, tokenizeDebugListing(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2684,6 +2682,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void varid_operator()
|
void varid_operator()
|
||||||
|
{
|
||||||
{
|
{
|
||||||
const std::string actual = tokenizeDebugListing(
|
const std::string actual = tokenizeDebugListing(
|
||||||
"class Foo\n"
|
"class Foo\n"
|
||||||
|
@ -2701,6 +2700,19 @@ private:
|
||||||
|
|
||||||
ASSERT_EQUALS(expected, actual);
|
ASSERT_EQUALS(expected, actual);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
const std::string actual = tokenizeDebugListing(
|
||||||
|
"struct Foo {\n"
|
||||||
|
" void * operator new [](int);\n"
|
||||||
|
"};\n");
|
||||||
|
const std::string expected("\n\n##file 0\n"
|
||||||
|
"1: struct Foo {\n"
|
||||||
|
"2: void * operator new [ ] ( int ) ;\n"
|
||||||
|
"3: } ;\n");
|
||||||
|
|
||||||
|
ASSERT_EQUALS(expected, actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void varid_throw() // ticket #1723
|
void varid_throw() // ticket #1723
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue