@@ -23,7 +23,6 @@ Author: Daniel Kroening, kroening@cs.cmu.edu
2323#include " cpp_member_spec.h"
2424#include " cpp_enum_type.h"
2525
26- #define DEBUG
2726#ifdef DEBUG
2827#include < iostream>
2928
@@ -1014,11 +1013,6 @@ bool Parser::rLinkageBody(cpp_linkage_spect::itemst &items)
10141013*/
10151014bool Parser::rTemplateDecl (cpp_declarationt &decl)
10161015{
1017- #ifdef DEBUG
1018- indenter _i;
1019- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl 1\n " ;
1020- #endif
1021-
10221016 TemplateDeclKind kind=tdk_unknown;
10231017
10241018 make_sub_scope (" #template" , new_scopet::kindt::TEMPLATE);
@@ -1028,10 +1022,6 @@ bool Parser::rTemplateDecl(cpp_declarationt &decl)
10281022 if (!rTemplateDecl2 (template_type, kind))
10291023 return false ;
10301024
1031- #ifdef DEBUG
1032- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl 2\n " ;
1033- #endif
1034-
10351025 cpp_declarationt body;
10361026 if (lex.LookAhead (0 )==TOK_USING)
10371027 {
@@ -1079,20 +1069,11 @@ bool Parser::rTemplateDecl(cpp_declarationt &decl)
10791069
10801070bool Parser::rTemplateDecl2 (typet &decl, TemplateDeclKind &kind)
10811071{
1082- #ifdef DEBUG
1083- indenter _i;
1084- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 1\n " ;
1085- #endif
1086-
10871072 cpp_tokent tk;
10881073
10891074 if (lex.get_token (tk)!=TOK_TEMPLATE)
10901075 return false ;
10911076
1092- #ifdef DEBUG
1093- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 2\n " ;
1094- #endif
1095-
10961077 decl=typet (ID_template);
10971078 set_location (decl, tk);
10981079
@@ -1103,33 +1084,17 @@ bool Parser::rTemplateDecl2(typet &decl, TemplateDeclKind &kind)
11031084 return true ; // ignore TEMPLATE
11041085 }
11051086
1106- #ifdef DEBUG
1107- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 3\n " ;
1108- #endif
1109-
11101087 if (lex.get_token (tk)!=' <' )
11111088 return false ;
11121089
11131090 irept &template_parameters=decl.add (ID_template_parameters);
11141091
1115- #ifdef DEBUG
1116- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 4\n " ;
1117- #endif
1118-
11191092 if (!rTempArgList (template_parameters))
11201093 return false ;
11211094
1122- #ifdef DEBUG
1123- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 5\n " ;
1124- #endif
1125-
11261095 if (lex.get_token (tk)!=' >' )
11271096 return false ;
11281097
1129- #ifdef DEBUG
1130- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 6\n " ;
1131- #endif
1132-
11331098 // ignore nested TEMPLATE
11341099 while (lex.LookAhead (0 )==TOK_TEMPLATE)
11351100 {
@@ -1146,10 +1111,6 @@ bool Parser::rTemplateDecl2(typet &decl, TemplateDeclKind &kind)
11461111 return false ;
11471112 }
11481113
1149- #ifdef DEBUG
1150- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 7\n " ;
1151- #endif
1152-
11531114 if (template_parameters.get_sub ().empty ())
11541115 // template < > declaration
11551116 kind=tdk_specialization;
@@ -1210,10 +1171,6 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
12101171
12111172 if ((t0==TOK_CLASS || t0==TOK_TYPENAME))
12121173 {
1213- #ifdef DEBUG
1214- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.1\n " ;
1215- #endif
1216-
12171174 cpp_token_buffert::post pos=lex.Save ();
12181175
12191176 cpp_tokent tk1;
@@ -1253,10 +1210,6 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
12531210
12541211 if (lex.LookAhead (0 )==' =' )
12551212 {
1256- #ifdef DEBUG
1257- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.2\n " ;
1258- #endif
1259-
12601213 if (declarator.get_has_ellipsis ())
12611214 return false ;
12621215
@@ -1269,38 +1222,10 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
12691222 declarator.value ()=exprt (ID_type);
12701223 declarator.value ().type ().swap (default_type);
12711224 }
1272- #ifdef DEBUG
1273- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.3\n " ;
1274- #endif
12751225
12761226 if (lex.LookAhead (0 )==' ,' ||
12771227 lex.LookAhead (0 )==' >' )
12781228 return true ;
1279- #if 0
1280- else if(lex.LookAhead(0) == TOK_SHIFTRIGHT)
1281- {
1282- #ifdef DEBUG
1283- std::cout << std::string(__indent, ' ') << "Parser::rTempArgDeclaration 0.4\n";
1284- #endif
1285-
1286- // turn >> into > >
1287- cpp_token_buffert::post pos=lex.Save();
1288- cpp_tokent tk;
1289- lex.get_token(tk);
1290- lex.Restore(pos);
1291- tk.kind='>';
1292- tk.text='>';
1293- lex.Replace(tk);
1294- lex.Insert(tk);
1295- DATA_INVARIANT(lex.LookAhead(0) == '>', "should be >");
1296- DATA_INVARIANT(lex.LookAhead(1) == '>', "should be >");
1297- return true;
1298- }
1299- #endif
1300- #ifdef DEBUG
1301- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.5\n " ;
1302- #endif
1303-
13041229
13051230 lex.Restore (pos);
13061231 }
@@ -4011,8 +3936,7 @@ bool Parser::rTemplateArgs(irept &template_args)
40113936 )
40123937 {
40133938#ifdef DEBUG
4014- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4 " <<
4015- lex.LookAhead (0 ) << " \n " ;
3939+ std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4\n " ;
40163940#endif
40173941
40183942 // ok
@@ -4024,30 +3948,20 @@ bool Parser::rTemplateArgs(irept &template_args)
40243948 lex.Restore (pos);
40253949 exprt tmp;
40263950 if (rConditionalExpr (tmp, true ))
4027- {
4028- #ifdef DEBUG
4029- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.0\n " ;
4030- #endif
40313951 exp.id (ID_ambiguous);
4032- }
40333952#ifdef DEBUG
40343953 std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.1\n " ;
40353954#endif
40363955 lex.Restore (pos);
40373956 rTypeNameOrFunctionType (a);
40383957
4039- #ifdef DEBUG
4040- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.1a " <<
4041- lex.LookAhead (0 ) << " \n " ;
4042- #endif
40433958 if (lex.LookAhead (0 )==TOK_ELLIPSIS)
40443959 {
40453960 lex.get_token (tk1);
40463961 exp.set (ID_ellipsis, true );
40473962 }
40483963#ifdef DEBUG
4049- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2 " <<
4050- lex.LookAhead (0 ) << " \n " ;
3964+ std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2\n " ;
40513965#endif
40523966 }
40533967 else
0 commit comments