fix #2844 fix to generate correct output
This commit is contained in:
parent
0bd26a73c4
commit
d80a55267c
|
@ -1219,12 +1219,14 @@ void Tokenizer::simplifyTypedef()
|
|||
// function pointer
|
||||
else if (Token::Match(tok->tokAt(offset), "( * %var% ) ("))
|
||||
{
|
||||
// name token wasn't a name, it was part of the type
|
||||
typeEnd = typeEnd->next();
|
||||
functionPtr = true;
|
||||
funcStart = tok->tokAt(offset + 1);
|
||||
funcEnd = tok->tokAt(offset)->link()->previous();
|
||||
typeName = tok->tokAt(offset)->link()->tokAt(-2);
|
||||
argStart = tok->tokAt(offset)->link()->next();
|
||||
argEnd = tok->tokAt(offset)->link()->next()->link();
|
||||
funcEnd = tok->tokAt(offset + 1);
|
||||
typeName = tok->tokAt(offset + 2);
|
||||
argStart = tok->tokAt(offset + 4);
|
||||
argEnd = tok->tokAt(offset + 4)->link();
|
||||
tok = argEnd->next();
|
||||
}
|
||||
|
||||
|
|
|
@ -5326,10 +5326,19 @@ private:
|
|||
|
||||
void simplifyTypedef95() // ticket #2844
|
||||
{
|
||||
const char code1[] = "class symbol_table {\n"
|
||||
"public:\n"
|
||||
" typedef expression_error::error_code (*valid_func)(void *cbparam, const char *name, expression_space space);\n"
|
||||
"};\n";
|
||||
const char code[] = "class symbol_table {\n"
|
||||
"public:\n"
|
||||
" typedef expression_error::error_code (*valid_func)(void *cbparam, const char *name, expression_space space);\n"
|
||||
" valid_func f;\n"
|
||||
"};\n";
|
||||
const char expected[] = "class symbol_table { "
|
||||
"public: "
|
||||
"; "
|
||||
"expression_error :: error_code ( * f ) ( void * cbparam , const char * name , expression_space space ) ; "
|
||||
"} ;";
|
||||
|
||||
checkSimplifyTypedef(code);
|
||||
ASSERT_EQUALS(expected, sizeof_(code));
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue