Tokenizer: fix for multiple array definitions for a single typedef
This commit is contained in:
parent
630d9ba552
commit
d17d199415
|
@ -579,6 +579,7 @@ void Tokenizer::simplifyTypedef()
|
|||
else
|
||||
{
|
||||
// unhandled typedef, skip it and continue
|
||||
tok = tok->tokAt(offset);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -816,6 +817,8 @@ void Tokenizer::simplifyTypedef()
|
|||
|
||||
if (tok->tokAt(offset) && tok->tokAt(offset)->str() == "[")
|
||||
{
|
||||
arrayStart = tok->tokAt(offset);
|
||||
|
||||
bool atEnd = false;
|
||||
while (!atEnd)
|
||||
{
|
||||
|
@ -831,6 +834,8 @@ void Tokenizer::simplifyTypedef()
|
|||
else
|
||||
offset++;
|
||||
}
|
||||
|
||||
arrayEnd = tok->tokAt(offset++);
|
||||
}
|
||||
|
||||
if (tok->tokAt(offset) && Token::Match(tok->tokAt(offset), ";|,"))
|
||||
|
|
|
@ -2976,17 +2976,23 @@ private:
|
|||
const char code[] = "typedef int array [ice_or<is_int<int>::value, is_int<UDT>::value>::value ? 1 : -1];\n"
|
||||
"typedef int array1 [N];\n"
|
||||
"typedef int array2 [N][M];\n"
|
||||
"typedef int int_t, int_array[N];\n"
|
||||
"array a;\n"
|
||||
"array1 a1;\n"
|
||||
"array2 a2;";
|
||||
"array2 a2;\n"
|
||||
"int_t t;\n"
|
||||
"int_array ia;";
|
||||
|
||||
const char expected[] =
|
||||
"; "
|
||||
"; "
|
||||
"; "
|
||||
"; "
|
||||
"int a [ ice_or < is_int < int > :: value , is_int < UDT > :: value > :: value ? 1 : - 1 ] ; "
|
||||
"int a1 [ N ] ; "
|
||||
"int a2 [ N ] [ M ] ;";
|
||||
"int a2 [ N ] [ M ] ; "
|
||||
"int t ; "
|
||||
"int ia [ N ] ;";
|
||||
|
||||
ASSERT_EQUALS(expected, tok(code, false));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue