Changes in src/main.cc [f77f12e2:d3b7937]
- File:
-
- 1 edited
-
src/main.cc (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/main.cc
rf77f12e2 rd3b7937 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // main.cc -- 7 // main.cc -- 8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Fri May 15 23:12:02 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Mon Apr 11 17:49:38201613 // Update Count : 20011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jan 27 22:20:20 2016 13 // Update Count : 199 14 14 // 15 15 … … 24 24 #include "SynTree/Declaration.h" 25 25 #include "SynTree/Visitor.h" 26 #include "GenPoly/InstantiateGeneric.h" 26 27 #include "GenPoly/Lvalue.h" 27 28 #include "GenPoly/Specialize.h" … … 41 42 #include "InitTweak/Mutate.h" 42 43 #include "InitTweak/RemoveInit.h" 43 #include "InitTweak/FixInit.h"44 44 //#include "Explain/GenProlog.h" 45 45 //#include "Try/Visit.h" … … 56 56 57 57 static void parse( FILE * input, LinkageSpec::Type t, bool shouldExit = false ); 58 static void dump( std::list< Declaration * > & translationUnit , std::ostream & out = std::cout);58 static void dump( std::list< Declaration * > & translationUnit ); 59 59 60 60 bool 61 61 astp = false, 62 62 bresolvep = false, 63 ctorinitp = false,64 63 exprp = false, 65 64 expraltp = false, … … 76 75 codegenp = false; 77 76 78 enum { Ast, Bresolver, CtorInitFix,Expr, ExprAlt, Grammar, LibCFA, Nopreamble, Parse, Prototypes, Resolver, Symbol, Tree, Validate, };77 enum { Ast, Bresolver, Expr, ExprAlt, Grammar, LibCFA, Nopreamble, Parse, Prototypes, Resolver, Symbol, Tree, Validate, }; 79 78 80 79 static struct option long_opts[] = { 81 80 { "ast", no_argument, 0, Ast }, 82 81 { "before-resolver", no_argument, 0, Bresolver }, 83 { "ctorinitfix", no_argument, 0, CtorInitFix },84 82 { "expr", no_argument, 0, Expr }, 85 83 { "expralt", no_argument, 0, ExprAlt }, … … 103 101 104 102 opterr = 0; // prevent getopt from printing error messages 105 103 106 104 int c; 107 while ( (c = getopt_long( argc, argv, "ab cefFglnpqrstvyzD:", long_opts, &long_index )) != -1 ) {105 while ( (c = getopt_long( argc, argv, "abefglnpqrstvyzD:", long_opts, &long_index )) != -1 ) { 108 106 switch ( c ) { 109 107 case Ast: … … 114 112 case 'b': // print before resolver steps 115 113 bresolvep = true; 116 break;117 case CtorInitFix:118 case 'c':119 ctorinitp = true;120 114 break; 121 115 case Expr: … … 194 188 output = new ofstream( argv[ optind ] ); 195 189 } // if 196 190 197 191 Parser::get_parser().set_debug( grammarp ); 198 192 … … 215 209 exit( 1 ); 216 210 } // if 217 211 218 212 parse( prelude, LinkageSpec::Intrinsic ); 219 213 } // if 220 214 } // if 221 215 222 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp ); 223 216 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp ); 217 224 218 if ( parsep ) { 225 219 Parser::get_parser().get_parseTree()->printList( std::cout ); … … 256 250 OPTPRINT( "mutate" ) 257 251 ControlStruct::mutate( translationUnit ); 258 OPTPRINT( "fixNames" ) 252 OPTPRINT( "fixNames" ) 259 253 CodeGen::fixNames( translationUnit ); 260 OPTPRINT( "tweak Init" )254 OPTPRINT( "tweak" ) 261 255 InitTweak::tweak( translationUnit ); 262 256 … … 275 269 if ( exprp ) { 276 270 dump( translationUnit ); 277 return 0;278 271 } 279 272 280 OPTPRINT( "fixInit" ) 281 // fix ObjectDecl - replaces ConstructorInit nodes 282 InitTweak::fix( translationUnit ); 283 if ( ctorinitp ) { 284 dump ( translationUnit ); 285 return 0; 286 } 287 273 OPTPRINT( "instantiateGeneric" ) 274 GenPoly::instantiateGeneric( translationUnit ); 288 275 OPTPRINT( "copyParams" ); 289 276 GenPoly::copyParams( translationUnit ); … … 308 295 } catch ( SemanticError &e ) { 309 296 if ( errorp ) { 310 std::cerr << "---AST at error:---" << std::endl; 311 dump( translationUnit, std::cerr ); 312 std::cerr << std::endl << "---End of AST, begin error message:---\n" << std::endl; 297 dump( translationUnit ); 313 298 } 314 299 e.print( std::cerr ); … … 332 317 } // try 333 318 334 deleteAll( translationUnit );335 319 return 0; 336 320 } // main … … 350 334 } 351 335 352 static void dump( std::list< Declaration * > & translationUnit , std::ostream & out) {336 static void dump( std::list< Declaration * > & translationUnit ) { 353 337 std::list< Declaration * > decls; 354 338 if ( noprotop ) { 355 filter( translationUnit.begin(), translationUnit.end(), 339 filter( translationUnit.begin(), translationUnit.end(), 356 340 std::back_inserter( decls ), notPrelude ); 357 341 } else { … … 359 343 } 360 344 361 printAll( decls, out );345 printAll( decls, std::cout ); 362 346 deleteAll( translationUnit ); 363 347 }
Note:
See TracChangeset
for help on using the changeset viewer.