@@ -1206,14 +1206,11 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
12061206 declarator.type ().make_nil ();
12071207 set_location (declarator, tk1);
12081208
1209- bool has_ellipsis=false ;
1210-
12111209 if (lex.LookAhead (0 )==TOK_ELLIPSIS)
12121210 {
12131211 cpp_tokent tk2;
12141212 lex.get_token (tk2);
1215-
1216- has_ellipsis=true ;
1213+ declarator.set_has_ellipsis ();
12171214 }
12181215
12191216 if (is_identifier (lex.LookAhead (0 )))
@@ -1225,16 +1222,11 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
12251222 set_location (declarator.name (), tk2);
12261223
12271224 add_id (declarator.name (), new_scopet::kindt::TYPE_TEMPLATE_PARAMETER);
1228-
1229- if (has_ellipsis)
1230- {
1231- // TODO
1232- }
12331225 }
12341226
12351227 if (lex.LookAhead (0 )==' =' )
12361228 {
1237- if (has_ellipsis )
1229+ if (declarator. get_has_ellipsis () )
12381230 return false ;
12391231
12401232 typet default_type;
@@ -1307,19 +1299,16 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
13071299 << " Parser::rTempArgDeclaration 3\n " ;
13081300#endif
13091301
1310- bool has_ellipsis=false ;
1302+ declaration.declarators ().resize (1 );
1303+ cpp_declaratort &declarator = declaration.declarators ().front ();
13111304
13121305 if (lex.LookAhead (0 )==TOK_ELLIPSIS)
13131306 {
13141307 cpp_tokent tk2;
13151308 lex.get_token (tk2);
1316-
1317- has_ellipsis=true ;
1309+ declarator.set_has_ellipsis ();
13181310 }
13191311
1320- declaration.declarators ().resize (1 );
1321- cpp_declaratort &declarator=declaration.declarators ().front ();
1322-
13231312 if (!rDeclarator (declarator, kArgDeclarator , true , false ))
13241313 return false ;
13251314
@@ -1330,16 +1319,11 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
13301319
13311320 add_id (declarator.name (), new_scopet::kindt::NON_TYPE_TEMPLATE_PARAMETER);
13321321
1333- if (has_ellipsis)
1334- {
1335- // TODO
1336- }
1337-
13381322 exprt &value=declarator.value ();
13391323
13401324 if (lex.LookAhead (0 )==' =' )
13411325 {
1342- if (has_ellipsis )
1326+ if (declarator. get_has_ellipsis () )
13431327 return false ;
13441328
13451329 cpp_tokent tk;
@@ -3998,8 +3982,7 @@ bool Parser::rTemplateArgs(irept &template_args)
39983982 if (lex.LookAhead (0 )==TOK_ELLIPSIS)
39993983 {
40003984 lex.get_token (tk1);
4001-
4002- // TODO
3985+ exp.set (ID_ellipsis, true );
40033986 }
40043987#ifdef DEBUG
40053988 std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2\n " ;
@@ -4017,13 +4000,6 @@ bool Parser::rTemplateArgs(irept &template_args)
40174000
40184001 if (!rConditionalExpr (exp, true ))
40194002 return false ;
4020-
4021- if (lex.LookAhead (0 )==TOK_ELLIPSIS)
4022- {
4023- lex.get_token (tk1);
4024-
4025- // TODO
4026- }
40274003 }
40284004
40294005#ifdef DEBUG
@@ -5676,18 +5652,21 @@ bool Parser::rTypeNameOrFunctionType(typet &tname)
56765652 type.parameters ().push_back (parameter);
56775653
56785654 t=lex.LookAhead (0 );
5679- if (t== ' , ' )
5655+ if (t == TOK_ELLIPSIS )
56805656 {
56815657 cpp_tokent tk;
56825658 lex.get_token (tk);
5659+ to_cpp_declaration (type.parameters ().back ())
5660+ .declarators ()
5661+ .back ()
5662+ .set_has_ellipsis ();
5663+ t = lex.LookAhead (0 );
56835664 }
5684- else if (t==TOK_ELLIPSIS)
5665+
5666+ if (t == ' ,' )
56855667 {
5686- // TODO -- this is actually ambiguous as it could refer to a
5687- // template parameter pack or declare a variadic function
56885668 cpp_tokent tk;
56895669 lex.get_token (tk);
5690- type.make_ellipsis ();
56915670 }
56925671 else if (t==' )' )
56935672 break ;
0 commit comments