@@ -1207,14 +1207,11 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1207
1207
declarator.type ().make_nil ();
1208
1208
set_location (declarator, tk1);
1209
1209
1210
- bool has_ellipsis=false ;
1211
-
1212
1210
if (lex.LookAhead (0 )==TOK_ELLIPSIS)
1213
1211
{
1214
1212
cpp_tokent tk2;
1215
1213
lex.get_token (tk2);
1216
-
1217
- has_ellipsis=true ;
1214
+ declarator.set_has_ellipsis ();
1218
1215
}
1219
1216
1220
1217
if (is_identifier (lex.LookAhead (0 )))
@@ -1226,16 +1223,11 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1226
1223
set_location (declarator.name (), tk2);
1227
1224
1228
1225
add_id (declarator.name (), new_scopet::kindt::TYPE_TEMPLATE_PARAMETER);
1229
-
1230
- if (has_ellipsis)
1231
- {
1232
- // TODO
1233
- }
1234
1226
}
1235
1227
1236
1228
if (lex.LookAhead (0 )==' =' )
1237
1229
{
1238
- if (has_ellipsis )
1230
+ if (declarator. get_has_ellipsis () )
1239
1231
return false ;
1240
1232
1241
1233
typet default_type;
@@ -1308,19 +1300,16 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1308
1300
<< " Parser::rTempArgDeclaration 3\n " ;
1309
1301
#endif
1310
1302
1311
- bool has_ellipsis=false ;
1303
+ declaration.declarators ().resize (1 );
1304
+ cpp_declaratort &declarator = declaration.declarators ().front ();
1312
1305
1313
1306
if (lex.LookAhead (0 )==TOK_ELLIPSIS)
1314
1307
{
1315
1308
cpp_tokent tk2;
1316
1309
lex.get_token (tk2);
1317
-
1318
- has_ellipsis=true ;
1310
+ declarator.set_has_ellipsis ();
1319
1311
}
1320
1312
1321
- declaration.declarators ().resize (1 );
1322
- cpp_declaratort &declarator=declaration.declarators ().front ();
1323
-
1324
1313
if (!rDeclarator (declarator, kArgDeclarator , true , false ))
1325
1314
return false ;
1326
1315
@@ -1331,16 +1320,11 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1331
1320
1332
1321
add_id (declarator.name (), new_scopet::kindt::NON_TYPE_TEMPLATE_PARAMETER);
1333
1322
1334
- if (has_ellipsis)
1335
- {
1336
- // TODO
1337
- }
1338
-
1339
1323
exprt &value=declarator.value ();
1340
1324
1341
1325
if (lex.LookAhead (0 )==' =' )
1342
1326
{
1343
- if (has_ellipsis )
1327
+ if (declarator. get_has_ellipsis () )
1344
1328
return false ;
1345
1329
1346
1330
cpp_tokent tk;
@@ -4006,8 +3990,7 @@ bool Parser::rTemplateArgs(irept &template_args)
4006
3990
if (lex.LookAhead (0 )==TOK_ELLIPSIS)
4007
3991
{
4008
3992
lex.get_token (tk1);
4009
-
4010
- // TODO
3993
+ exp .set (ID_ellipsis, true );
4011
3994
}
4012
3995
#ifdef DEBUG
4013
3996
std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2\n " ;
@@ -4025,13 +4008,6 @@ bool Parser::rTemplateArgs(irept &template_args)
4025
4008
4026
4009
if (!rConditionalExpr (exp , true ))
4027
4010
return false ;
4028
-
4029
- if (lex.LookAhead (0 )==TOK_ELLIPSIS)
4030
- {
4031
- lex.get_token (tk1);
4032
-
4033
- // TODO
4034
- }
4035
4011
}
4036
4012
4037
4013
#ifdef DEBUG
@@ -5684,18 +5660,21 @@ bool Parser::rTypeNameOrFunctionType(typet &tname)
5684
5660
type.parameters ().push_back (parameter);
5685
5661
5686
5662
t=lex.LookAhead (0 );
5687
- if (t== ' , ' )
5663
+ if (t == TOK_ELLIPSIS )
5688
5664
{
5689
5665
cpp_tokent tk;
5690
5666
lex.get_token (tk);
5667
+ to_cpp_declaration (type.parameters ().back ())
5668
+ .declarators ()
5669
+ .back ()
5670
+ .set_has_ellipsis ();
5671
+ t = lex.LookAhead (0 );
5691
5672
}
5692
- else if (t==TOK_ELLIPSIS)
5673
+
5674
+ if (t == ' ,' )
5693
5675
{
5694
- // TODO -- this is actually ambiguous as it could refer to a
5695
- // template parameter pack or declare a variadic function
5696
5676
cpp_tokent tk;
5697
5677
lex.get_token (tk);
5698
- type.make_ellipsis ();
5699
5678
}
5700
5679
else if (t==' )' )
5701
5680
break ;
0 commit comments