@@ -1207,14 +1207,11 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
12071207 declarator.type ().make_nil ();
12081208 set_location (declarator, tk1);
12091209
1210- bool has_ellipsis=false ;
1211-
12121210 if (lex.LookAhead (0 )==TOK_ELLIPSIS)
12131211 {
12141212 cpp_tokent tk2;
12151213 lex.get_token (tk2);
1216-
1217- has_ellipsis=true ;
1214+ declarator.set_has_ellipsis ();
12181215 }
12191216
12201217 if (is_identifier (lex.LookAhead (0 )))
@@ -1226,16 +1223,11 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
12261223 set_location (declarator.name (), tk2);
12271224
12281225 add_id (declarator.name (), new_scopet::kindt::TYPE_TEMPLATE_PARAMETER);
1229-
1230- if (has_ellipsis)
1231- {
1232- // TODO
1233- }
12341226 }
12351227
12361228 if (lex.LookAhead (0 )==' =' )
12371229 {
1238- if (has_ellipsis )
1230+ if (declarator. get_has_ellipsis () )
12391231 return false ;
12401232
12411233 typet default_type;
@@ -1308,19 +1300,16 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
13081300 << " Parser::rTempArgDeclaration 3\n " ;
13091301#endif
13101302
1311- bool has_ellipsis=false ;
1303+ declaration.declarators ().resize (1 );
1304+ cpp_declaratort &declarator = declaration.declarators ().front ();
13121305
13131306 if (lex.LookAhead (0 )==TOK_ELLIPSIS)
13141307 {
13151308 cpp_tokent tk2;
13161309 lex.get_token (tk2);
1317-
1318- has_ellipsis=true ;
1310+ declarator.set_has_ellipsis ();
13191311 }
13201312
1321- declaration.declarators ().resize (1 );
1322- cpp_declaratort &declarator=declaration.declarators ().front ();
1323-
13241313 if (!rDeclarator (declarator, kArgDeclarator , true , false ))
13251314 return false ;
13261315
@@ -1331,16 +1320,11 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
13311320
13321321 add_id (declarator.name (), new_scopet::kindt::NON_TYPE_TEMPLATE_PARAMETER);
13331322
1334- if (has_ellipsis)
1335- {
1336- // TODO
1337- }
1338-
13391323 exprt &value=declarator.value ();
13401324
13411325 if (lex.LookAhead (0 )==' =' )
13421326 {
1343- if (has_ellipsis )
1327+ if (declarator. get_has_ellipsis () )
13441328 return false ;
13451329
13461330 cpp_tokent tk;
@@ -4006,8 +3990,7 @@ bool Parser::rTemplateArgs(irept &template_args)
40063990 if (lex.LookAhead (0 )==TOK_ELLIPSIS)
40073991 {
40083992 lex.get_token (tk1);
4009-
4010- // TODO
3993+ exp.set (ID_ellipsis, true );
40113994 }
40123995#ifdef DEBUG
40133996 std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2\n " ;
@@ -4025,13 +4008,6 @@ bool Parser::rTemplateArgs(irept &template_args)
40254008
40264009 if (!rConditionalExpr (exp, true ))
40274010 return false ;
4028-
4029- if (lex.LookAhead (0 )==TOK_ELLIPSIS)
4030- {
4031- lex.get_token (tk1);
4032-
4033- // TODO
4034- }
40354011 }
40364012
40374013#ifdef DEBUG
@@ -5684,18 +5660,21 @@ bool Parser::rTypeNameOrFunctionType(typet &tname)
56845660 type.parameters ().push_back (parameter);
56855661
56865662 t=lex.LookAhead (0 );
5687- if (t== ' , ' )
5663+ if (t == TOK_ELLIPSIS )
56885664 {
56895665 cpp_tokent tk;
56905666 lex.get_token (tk);
5667+ to_cpp_declaration (type.parameters ().back ())
5668+ .declarators ()
5669+ .back ()
5670+ .set_has_ellipsis ();
5671+ t = lex.LookAhead (0 );
56915672 }
5692- else if (t==TOK_ELLIPSIS)
5673+
5674+ if (t == ' ,' )
56935675 {
5694- // TODO -- this is actually ambiguous as it could refer to a
5695- // template parameter pack or declare a variadic function
56965676 cpp_tokent tk;
56975677 lex.get_token (tk);
5698- type.make_ellipsis ();
56995678 }
57005679 else if (t==' )' )
57015680 break ;
0 commit comments