Better handling of function pointer typedef
This commit is contained in:
parent
ac7515cdcc
commit
a390f3c8f4
|
@ -878,6 +878,22 @@ void Tokenizer::simplifyTypedef()
|
|||
continue;
|
||||
}
|
||||
}
|
||||
else if (tok->tokAt(offset) && Token::Match(tok->tokAt(offset), "( %type% ("))
|
||||
{
|
||||
function = true;
|
||||
if (tok->tokAt(offset)->link()->next())
|
||||
{
|
||||
typeName = tok->tokAt(offset + 1);
|
||||
argStart = tok->tokAt(offset + 2);
|
||||
argEnd = tok->tokAt(offset + 2)->link();
|
||||
tok = tok->tokAt(offset)->link()->next();
|
||||
}
|
||||
else
|
||||
{
|
||||
// internal error
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// unhandled typedef, skip it and continue
|
||||
|
|
|
@ -3932,6 +3932,16 @@ private:
|
|||
"std :: queue < void ( * ) ( arg_class * ) > func_queue ;");
|
||||
ASSERT_EQUALS(expected, sizeof_(code));
|
||||
}
|
||||
|
||||
{
|
||||
const char code[] = "typedef void (my_func(arg_class*));\n"
|
||||
"std::queue<my_func *> func_queue;";
|
||||
|
||||
// The expected result..
|
||||
const std::string expected("; "
|
||||
"std :: queue < void ( * ) ( arg_class * ) > func_queue ;");
|
||||
ASSERT_EQUALS(expected, sizeof_(code));
|
||||
}
|
||||
}
|
||||
|
||||
void reverseArraySyntax()
|
||||
|
|
Loading…
Reference in New Issue