@@ -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
@@ -1047,11 +1046,6 @@ bool Parser::rLinkageBody(cpp_linkage_spect::itemst &items)
10471046*/
10481047bool Parser::rTemplateDecl (cpp_declarationt &decl)
10491048{
1050- #ifdef DEBUG
1051- indenter _i;
1052- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl 1\n " ;
1053- #endif
1054-
10551049 TemplateDeclKind kind=tdk_unknown;
10561050
10571051 make_sub_scope (" #template" , new_scopet::kindt::TEMPLATE);
@@ -1061,10 +1055,6 @@ bool Parser::rTemplateDecl(cpp_declarationt &decl)
10611055 if (!rTemplateDecl2 (template_type, kind))
10621056 return false ;
10631057
1064- #ifdef DEBUG
1065- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl 2\n " ;
1066- #endif
1067-
10681058 cpp_declarationt body;
10691059 if (lex.LookAhead (0 )==TOK_USING)
10701060 {
@@ -1112,20 +1102,11 @@ bool Parser::rTemplateDecl(cpp_declarationt &decl)
11121102
11131103bool Parser::rTemplateDecl2 (typet &decl, TemplateDeclKind &kind)
11141104{
1115- #ifdef DEBUG
1116- indenter _i;
1117- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 1\n " ;
1118- #endif
1119-
11201105 cpp_tokent tk;
11211106
11221107 if (lex.get_token (tk)!=TOK_TEMPLATE)
11231108 return false ;
11241109
1125- #ifdef DEBUG
1126- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 2\n " ;
1127- #endif
1128-
11291110 decl=typet (ID_template);
11301111 set_location (decl, tk);
11311112
@@ -1136,33 +1117,17 @@ bool Parser::rTemplateDecl2(typet &decl, TemplateDeclKind &kind)
11361117 return true ; // ignore TEMPLATE
11371118 }
11381119
1139- #ifdef DEBUG
1140- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 3\n " ;
1141- #endif
1142-
11431120 if (lex.get_token (tk)!=' <' )
11441121 return false ;
11451122
11461123 irept &template_parameters=decl.add (ID_template_parameters);
11471124
1148- #ifdef DEBUG
1149- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 4\n " ;
1150- #endif
1151-
11521125 if (!rTempArgList (template_parameters))
11531126 return false ;
11541127
1155- #ifdef DEBUG
1156- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 5\n " ;
1157- #endif
1158-
11591128 if (lex.get_token (tk)!=' >' )
11601129 return false ;
11611130
1162- #ifdef DEBUG
1163- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 6\n " ;
1164- #endif
1165-
11661131 // ignore nested TEMPLATE
11671132 while (lex.LookAhead (0 )==TOK_TEMPLATE)
11681133 {
@@ -1179,10 +1144,6 @@ bool Parser::rTemplateDecl2(typet &decl, TemplateDeclKind &kind)
11791144 return false ;
11801145 }
11811146
1182- #ifdef DEBUG
1183- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 7\n " ;
1184- #endif
1185-
11861147 if (template_parameters.get_sub ().empty ())
11871148 // template < > declaration
11881149 kind=tdk_specialization;
@@ -1243,10 +1204,6 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
12431204
12441205 if ((t0==TOK_CLASS || t0==TOK_TYPENAME))
12451206 {
1246- #ifdef DEBUG
1247- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.1\n " ;
1248- #endif
1249-
12501207 cpp_token_buffert::post pos=lex.Save ();
12511208
12521209 cpp_tokent tk1;
@@ -1286,10 +1243,6 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
12861243
12871244 if (lex.LookAhead (0 )==' =' )
12881245 {
1289- #ifdef DEBUG
1290- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.2\n " ;
1291- #endif
1292-
12931246 if (declarator.get_has_ellipsis ())
12941247 return false ;
12951248
@@ -1302,38 +1255,10 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
13021255 declarator.value ()=exprt (ID_type);
13031256 declarator.value ().type ().swap (default_type);
13041257 }
1305- #ifdef DEBUG
1306- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.3\n " ;
1307- #endif
13081258
13091259 if (lex.LookAhead (0 )==' ,' ||
13101260 lex.LookAhead (0 )==' >' )
13111261 return true ;
1312- #if 0
1313- else if(lex.LookAhead(0) == TOK_SHIFTRIGHT)
1314- {
1315- #ifdef DEBUG
1316- std::cout << std::string(__indent, ' ') << "Parser::rTempArgDeclaration 0.4\n";
1317- #endif
1318-
1319- // turn >> into > >
1320- cpp_token_buffert::post pos=lex.Save();
1321- cpp_tokent tk;
1322- lex.get_token(tk);
1323- lex.Restore(pos);
1324- tk.kind='>';
1325- tk.text='>';
1326- lex.Replace(tk);
1327- lex.Insert(tk);
1328- DATA_INVARIANT(lex.LookAhead(0) == '>', "should be >");
1329- DATA_INVARIANT(lex.LookAhead(1) == '>', "should be >");
1330- return true;
1331- }
1332- #endif
1333- #ifdef DEBUG
1334- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.5\n " ;
1335- #endif
1336-
13371262
13381263 lex.Restore (pos);
13391264 }
@@ -4059,8 +3984,7 @@ bool Parser::rTemplateArgs(irept &template_args)
40593984 )
40603985 {
40613986#ifdef DEBUG
4062- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4 " <<
4063- lex.LookAhead (0 ) << " \n " ;
3987+ std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4\n " ;
40643988#endif
40653989
40663990 // ok
@@ -4072,30 +3996,20 @@ bool Parser::rTemplateArgs(irept &template_args)
40723996 lex.Restore (pos);
40733997 exprt tmp;
40743998 if (rConditionalExpr (tmp, true ))
4075- {
4076- #ifdef DEBUG
4077- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.0\n " ;
4078- #endif
40793999 exp.id (ID_ambiguous);
4080- }
40814000#ifdef DEBUG
40824001 std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.1\n " ;
40834002#endif
40844003 lex.Restore (pos);
40854004 rTypeNameOrFunctionType (a);
40864005
4087- #ifdef DEBUG
4088- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.1a " <<
4089- lex.LookAhead (0 ) << " \n " ;
4090- #endif
40914006 if (lex.LookAhead (0 )==TOK_ELLIPSIS)
40924007 {
40934008 lex.get_token (tk1);
40944009 exp.set (ID_ellipsis, true );
40954010 }
40964011#ifdef DEBUG
4097- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2 " <<
4098- lex.LookAhead (0 ) << " \n " ;
4012+ std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2\n " ;
40994013#endif
41004014 }
41014015 else
0 commit comments