Changes in src/main.cc [cbd1ba8:64b3cda]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main.cc
rcbd1ba8 r64b3cda 228 228 ostream * output = & cout; 229 229 list< Declaration * > translationUnit; 230 ast::TranslationUnit transUnit; 230 231 231 232 Signal( SIGSEGV, sigSegvBusHandler, SA_SIGINFO ); … … 294 295 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, yydebug ); 295 296 296 if ( parsep ) { 297 dumpParseTree( cout ); 298 return EXIT_SUCCESS; 299 } // if 300 301 translationUnit = buildUnit(); 297 transUnit = buildUnit(); 302 298 303 299 if ( astp ) { 304 dump( translationUnit ); 305 return EXIT_SUCCESS; 306 } // if 307 308 // Temporary: fill locations after parsing so that every node has a location, for early error messages. 309 // Eventually we should pass the locations from the parser to every node, but this quick and dirty solution 310 // works okay for now. 311 CodeTools::fillLocations( translationUnit ); 300 dump( std::move( transUnit ) ); 301 return EXIT_SUCCESS; 302 } // if 303 312 304 Stats::Time::StopBlock(); 313 305 … … 316 308 ast::pass_visitor_stats.max = Stats::Counters::build<Stats::Counters::MaxCounter<double>>("Max depth - New"); 317 309 } 318 auto transUnit = convert( std::move( translationUnit ) ); 319 320 forceFillCodeLocations( transUnit ); 321 322 PASS( "Translate Exception Declarations", ControlStruct::translateExcept( transUnit ) ); 323 if ( exdeclp ) { 324 dump( std::move( transUnit ) ); 325 return EXIT_SUCCESS; 326 } 327 328 PASS( "Verify Ctor, Dtor & Assign", Validate::verifyCtorDtorAssign( transUnit ) ); 310 329 311 PASS( "Hoist Type Decls", Validate::hoistTypeDecls( transUnit ) ); 330 312 // Hoist Type Decls pulls some declarations out of contexts where … … 333 315 forceFillCodeLocations( transUnit ); 334 316 317 PASS( "Translate Exception Declarations", ControlStruct::translateExcept( transUnit ) ); 318 if ( exdeclp ) { 319 dump( std::move( transUnit ) ); 320 return EXIT_SUCCESS; 321 } 322 323 PASS( "Verify Ctor, Dtor & Assign", Validate::verifyCtorDtorAssign( transUnit ) ); 335 324 PASS( "Replace Typedefs", Validate::replaceTypedef( transUnit ) ); 336 325 PASS( "Fix Return Types", Validate::fixReturnTypes( transUnit ) ); … … 474 463 if ( errorp ) { 475 464 cerr << "---AST at error:---" << endl; 476 dump( translationUnit, cerr ); 465 // We check which section the errors came from without looking at 466 // transUnit because std::move means it could look like anything. 467 if ( !translationUnit.empty() ) { 468 dump( translationUnit, cerr ); 469 } else { 470 dump( std::move( transUnit ), cerr ); 471 } 477 472 cerr << endl << "---End of AST, begin error message:---\n" << endl; 478 473 } // if … … 578 573 { "rproto", resolvprotop, true, "resolver-proto instance" }, 579 574 { "rsteps", resolvep, true, "print resolver steps" }, 580 { "tree", parsep, true, "print parse tree" },581 575 // code dumps 582 576 { "ast", astp, true, "print AST after parsing" },
Note: See TracChangeset
for help on using the changeset viewer.