@@ -1206,14 +1206,11 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1206
1206
declarator.type ().make_nil ();
1207
1207
set_location (declarator, tk1);
1208
1208
1209
- bool has_ellipsis=false ;
1210
-
1211
1209
if (lex.LookAhead (0 )==TOK_ELLIPSIS)
1212
1210
{
1213
1211
cpp_tokent tk2;
1214
1212
lex.get_token (tk2);
1215
-
1216
- has_ellipsis=true ;
1213
+ declarator.set_has_ellipsis ();
1217
1214
}
1218
1215
1219
1216
if (is_identifier (lex.LookAhead (0 )))
@@ -1225,16 +1222,11 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1225
1222
set_location (declarator.name (), tk2);
1226
1223
1227
1224
add_id (declarator.name (), new_scopet::kindt::TYPE_TEMPLATE_PARAMETER);
1228
-
1229
- if (has_ellipsis)
1230
- {
1231
- // TODO
1232
- }
1233
1225
}
1234
1226
1235
1227
if (lex.LookAhead (0 )==' =' )
1236
1228
{
1237
- if (has_ellipsis )
1229
+ if (declarator. get_has_ellipsis () )
1238
1230
return false ;
1239
1231
1240
1232
typet default_type;
@@ -1307,19 +1299,16 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1307
1299
<< " Parser::rTempArgDeclaration 3\n " ;
1308
1300
#endif
1309
1301
1310
- bool has_ellipsis=false ;
1302
+ declaration.declarators ().resize (1 );
1303
+ cpp_declaratort &declarator = declaration.declarators ().front ();
1311
1304
1312
1305
if (lex.LookAhead (0 )==TOK_ELLIPSIS)
1313
1306
{
1314
1307
cpp_tokent tk2;
1315
1308
lex.get_token (tk2);
1316
-
1317
- has_ellipsis=true ;
1309
+ declarator.set_has_ellipsis ();
1318
1310
}
1319
1311
1320
- declaration.declarators ().resize (1 );
1321
- cpp_declaratort &declarator=declaration.declarators ().front ();
1322
-
1323
1312
if (!rDeclarator (declarator, kArgDeclarator , true , false ))
1324
1313
return false ;
1325
1314
@@ -1330,16 +1319,11 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1330
1319
1331
1320
add_id (declarator.name (), new_scopet::kindt::NON_TYPE_TEMPLATE_PARAMETER);
1332
1321
1333
- if (has_ellipsis)
1334
- {
1335
- // TODO
1336
- }
1337
-
1338
1322
exprt &value=declarator.value ();
1339
1323
1340
1324
if (lex.LookAhead (0 )==' =' )
1341
1325
{
1342
- if (has_ellipsis )
1326
+ if (declarator. get_has_ellipsis () )
1343
1327
return false ;
1344
1328
1345
1329
cpp_tokent tk;
@@ -3998,8 +3982,7 @@ bool Parser::rTemplateArgs(irept &template_args)
3998
3982
if (lex.LookAhead (0 )==TOK_ELLIPSIS)
3999
3983
{
4000
3984
lex.get_token (tk1);
4001
-
4002
- // TODO
3985
+ exp .set (ID_ellipsis, true );
4003
3986
}
4004
3987
#ifdef DEBUG
4005
3988
std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2\n " ;
@@ -4017,13 +4000,6 @@ bool Parser::rTemplateArgs(irept &template_args)
4017
4000
4018
4001
if (!rConditionalExpr (exp , true ))
4019
4002
return false ;
4020
-
4021
- if (lex.LookAhead (0 )==TOK_ELLIPSIS)
4022
- {
4023
- lex.get_token (tk1);
4024
-
4025
- // TODO
4026
- }
4027
4003
}
4028
4004
4029
4005
#ifdef DEBUG
@@ -5676,18 +5652,21 @@ bool Parser::rTypeNameOrFunctionType(typet &tname)
5676
5652
type.parameters ().push_back (parameter);
5677
5653
5678
5654
t=lex.LookAhead (0 );
5679
- if (t== ' , ' )
5655
+ if (t == TOK_ELLIPSIS )
5680
5656
{
5681
5657
cpp_tokent tk;
5682
5658
lex.get_token (tk);
5659
+ to_cpp_declaration (type.parameters ().back ())
5660
+ .declarators ()
5661
+ .back ()
5662
+ .set_has_ellipsis ();
5663
+ t = lex.LookAhead (0 );
5683
5664
}
5684
- else if (t==TOK_ELLIPSIS)
5665
+
5666
+ if (t == ' ,' )
5685
5667
{
5686
- // TODO -- this is actually ambiguous as it could refer to a
5687
- // template parameter pack or declare a variadic function
5688
5668
cpp_tokent tk;
5689
5669
lex.get_token (tk);
5690
- type.make_ellipsis ();
5691
5670
}
5692
5671
else if (t==' )' )
5693
5672
break ;
0 commit comments