Changeset 1ab4ce2
- Timestamp:
- Jul 15, 2015, 4:47:34 PM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 724c2b6
- Parents:
- 145f1fc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main.cc
r145f1fc r1ab4ce2 10 10 // Created On : Fri May 15 23:12:02 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Mon Jul 06 15:01:26201513 // Update Count : 7912 // Last Modified On : Wed Jul 15 16:45:24 2015 13 // Update Count : 145 14 14 // 15 15 … … 54 54 if ( errorp ) std::cerr << x << std::endl; 55 55 56 void parse( FILE * input, LinkageSpec::Type t, bool shouldExit = false ); 56 static void parse( FILE * input, LinkageSpec::Type t, bool shouldExit = false ); 57 static void dump( std::list< Declaration * > & translationUnit ); 57 58 58 59 bool … … 64 65 libcfap = false, 65 66 nopreludep = false, 66 protop = false,67 noprotop = false, 67 68 parsep = false, 68 69 resolvep = false, // used in AlternativeFinder … … 81 82 { "grammar", no_argument, 0, Grammar }, 82 83 { "libcfa", no_argument, 0, LibCFA }, 83 { "no preamble", no_argument, 0, Nopreamble },84 { "no-preamble", no_argument, 0, Nopreamble }, 84 85 { "parse", no_argument, 0, Parse }, 85 { " prototypes", no_argument, 0, Prototypes },86 { "no-prototypes", no_argument, 0, Prototypes }, 86 87 { "resolver", no_argument, 0, Resolver }, 87 88 { "symbol", no_argument, 0, Symbol }, … … 131 132 case Prototypes: 132 133 case 'p': // generate prototypes for preamble functions 133 protop = true;134 noprotop = true; 134 135 break; 135 136 case Parse: … … 221 222 Parser::get_parser().freeTree(); 222 223 if ( astp ) { 223 printAll( translationUnit, std::cout );224 dump( translationUnit ); 224 225 return 0; 225 226 } // if … … 242 243 243 244 if ( validp ) { 244 printAll( translationUnit, std::cout );245 dump( translationUnit ); 245 246 return 0; 246 247 } // if … … 252 253 253 254 if ( libcfap ) { 254 protop = true;255 255 // generate the bodies of cfa library functions 256 256 LibCfa::makeLibCfa( translationUnit ); … … 258 258 259 259 if ( bresolvep ) { 260 printAll( translationUnit, std::cout );260 dump( translationUnit ); 261 261 return 0; 262 262 } // if … … 265 265 ResolvExpr::resolve( translationUnit ); 266 266 if ( exprp ) { 267 printAll( translationUnit, std::cout );267 dump( translationUnit ); 268 268 } 269 269 … … 279 279 // print tree right before code generation 280 280 if ( codegenp ) { 281 printAll( translationUnit, std::cout );282 return 0; 283 } // if 284 285 CodeGen::generate( translationUnit, *output, true ); //protop );281 dump( translationUnit ); 282 return 0; 283 } // if 284 285 CodeGen::generate( translationUnit, *output, ! noprotop ); 286 286 287 287 if ( output != &std::cout ) { … … 290 290 } catch ( SemanticError &e ) { 291 291 if ( errorp ) { 292 printAll( translationUnit, std::cerr);292 dump( translationUnit ); 293 293 } 294 294 e.print( std::cerr ); … … 315 315 } // main 316 316 317 void parse( FILE * input, LinkageSpec::Type linkage, bool shouldExit ) {317 static void parse( FILE * input, LinkageSpec::Type linkage, bool shouldExit ) { 318 318 Parser::get_parser().set_linkage( linkage ); 319 319 Parser::get_parser().parse( input ); … … 325 325 } 326 326 327 static bool notPrelude( Declaration * decl ) { 328 return ! LinkageSpec::isBuiltin( decl->get_linkage() ); 329 } 330 331 static void dump( std::list< Declaration * > & translationUnit ) { 332 std::list< Declaration * > decls; 333 if ( noprotop ) { 334 filter( translationUnit.begin(), translationUnit.end(), 335 std::back_inserter( decls ), notPrelude ); 336 } else { 337 decls = translationUnit; 338 } 339 340 printAll( decls, std::cout ); 341 } 342 343 327 344 // Local Variables: // 328 345 // tab-width: 4 //
Note: See TracChangeset
for help on using the changeset viewer.