@@ -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
@@ -1031,11 +1030,6 @@ bool Parser::rLinkageBody(cpp_linkage_spect::itemst &items)
10311030*/
10321031bool Parser::rTemplateDecl (cpp_declarationt &decl)
10331032{
1034- #ifdef DEBUG
1035- indenter _i;
1036- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl 1\n " ;
1037- #endif
1038-
10391033 TemplateDeclKind kind=tdk_unknown;
10401034
10411035 make_sub_scope (" #template" , new_scopet::kindt::TEMPLATE);
@@ -1045,10 +1039,6 @@ bool Parser::rTemplateDecl(cpp_declarationt &decl)
10451039 if (!rTemplateDecl2 (template_type, kind))
10461040 return false ;
10471041
1048- #ifdef DEBUG
1049- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl 2\n " ;
1050- #endif
1051-
10521042 cpp_declarationt body;
10531043 if (lex.LookAhead (0 )==TOK_USING)
10541044 {
@@ -1096,20 +1086,11 @@ bool Parser::rTemplateDecl(cpp_declarationt &decl)
10961086
10971087bool Parser::rTemplateDecl2 (typet &decl, TemplateDeclKind &kind)
10981088{
1099- #ifdef DEBUG
1100- indenter _i;
1101- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 1\n " ;
1102- #endif
1103-
11041089 cpp_tokent tk;
11051090
11061091 if (lex.get_token (tk)!=TOK_TEMPLATE)
11071092 return false ;
11081093
1109- #ifdef DEBUG
1110- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 2\n " ;
1111- #endif
1112-
11131094 decl=typet (ID_template);
11141095 set_location (decl, tk);
11151096
@@ -1120,33 +1101,17 @@ bool Parser::rTemplateDecl2(typet &decl, TemplateDeclKind &kind)
11201101 return true ; // ignore TEMPLATE
11211102 }
11221103
1123- #ifdef DEBUG
1124- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 3\n " ;
1125- #endif
1126-
11271104 if (lex.get_token (tk)!=' <' )
11281105 return false ;
11291106
11301107 irept &template_parameters=decl.add (ID_template_parameters);
11311108
1132- #ifdef DEBUG
1133- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 4\n " ;
1134- #endif
1135-
11361109 if (!rTempArgList (template_parameters))
11371110 return false ;
11381111
1139- #ifdef DEBUG
1140- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 5\n " ;
1141- #endif
1142-
11431112 if (lex.get_token (tk)!=' >' )
11441113 return false ;
11451114
1146- #ifdef DEBUG
1147- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 6\n " ;
1148- #endif
1149-
11501115 // ignore nested TEMPLATE
11511116 while (lex.LookAhead (0 )==TOK_TEMPLATE)
11521117 {
@@ -1163,10 +1128,6 @@ bool Parser::rTemplateDecl2(typet &decl, TemplateDeclKind &kind)
11631128 return false ;
11641129 }
11651130
1166- #ifdef DEBUG
1167- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 7\n " ;
1168- #endif
1169-
11701131 if (template_parameters.get_sub ().empty ())
11711132 // template < > declaration
11721133 kind=tdk_specialization;
@@ -1227,10 +1188,6 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
12271188
12281189 if ((t0==TOK_CLASS || t0==TOK_TYPENAME))
12291190 {
1230- #ifdef DEBUG
1231- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.1\n " ;
1232- #endif
1233-
12341191 cpp_token_buffert::post pos=lex.Save ();
12351192
12361193 cpp_tokent tk1;
@@ -1270,10 +1227,6 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
12701227
12711228 if (lex.LookAhead (0 )==' =' )
12721229 {
1273- #ifdef DEBUG
1274- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.2\n " ;
1275- #endif
1276-
12771230 if (declarator.get_has_ellipsis ())
12781231 return false ;
12791232
@@ -1286,38 +1239,10 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
12861239 declarator.value ()=exprt (ID_type);
12871240 declarator.value ().type ().swap (default_type);
12881241 }
1289- #ifdef DEBUG
1290- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.3\n " ;
1291- #endif
12921242
12931243 if (lex.LookAhead (0 )==' ,' ||
12941244 lex.LookAhead (0 )==' >' )
12951245 return true ;
1296- #if 0
1297- else if(lex.LookAhead(0) == TOK_SHIFTRIGHT)
1298- {
1299- #ifdef DEBUG
1300- std::cout << std::string(__indent, ' ') << "Parser::rTempArgDeclaration 0.4\n";
1301- #endif
1302-
1303- // turn >> into > >
1304- cpp_token_buffert::post pos=lex.Save();
1305- cpp_tokent tk;
1306- lex.get_token(tk);
1307- lex.Restore(pos);
1308- tk.kind='>';
1309- tk.text='>';
1310- lex.Replace(tk);
1311- lex.Insert(tk);
1312- DATA_INVARIANT(lex.LookAhead(0) == '>', "should be >");
1313- DATA_INVARIANT(lex.LookAhead(1) == '>', "should be >");
1314- return true;
1315- }
1316- #endif
1317- #ifdef DEBUG
1318- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.5\n " ;
1319- #endif
1320-
13211246
13221247 lex.Restore (pos);
13231248 }
@@ -4043,8 +3968,7 @@ bool Parser::rTemplateArgs(irept &template_args)
40433968 )
40443969 {
40453970#ifdef DEBUG
4046- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4 " <<
4047- lex.LookAhead (0 ) << " \n " ;
3971+ std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4\n " ;
40483972#endif
40493973
40503974 // ok
@@ -4056,30 +3980,20 @@ bool Parser::rTemplateArgs(irept &template_args)
40563980 lex.Restore (pos);
40573981 exprt tmp;
40583982 if (rConditionalExpr (tmp, true ))
4059- {
4060- #ifdef DEBUG
4061- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.0\n " ;
4062- #endif
40633983 exp.id (ID_ambiguous);
4064- }
40653984#ifdef DEBUG
40663985 std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.1\n " ;
40673986#endif
40683987 lex.Restore (pos);
40693988 rTypeNameOrFunctionType (a);
40703989
4071- #ifdef DEBUG
4072- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.1a " <<
4073- lex.LookAhead (0 ) << " \n " ;
4074- #endif
40753990 if (lex.LookAhead (0 )==TOK_ELLIPSIS)
40763991 {
40773992 lex.get_token (tk1);
40783993 exp.set (ID_ellipsis, true );
40793994 }
40803995#ifdef DEBUG
4081- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2 " <<
4082- lex.LookAhead (0 ) << " \n " ;
3996+ std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2\n " ;
40833997#endif
40843998 }
40853999 else
0 commit comments