Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main.cc

    rcbd1ba8 r64b3cda  
    228228        ostream * output = & cout;
    229229        list< Declaration * > translationUnit;
     230        ast::TranslationUnit transUnit;
    230231
    231232        Signal( SIGSEGV, sigSegvBusHandler, SA_SIGINFO );
     
    294295                parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, yydebug );
    295296
    296                 if ( parsep ) {
    297                         dumpParseTree( cout );
    298                         return EXIT_SUCCESS;
    299                 } // if
    300 
    301                 translationUnit = buildUnit();
     297                transUnit = buildUnit();
    302298
    303299                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
    312304                Stats::Time::StopBlock();
    313305
     
    316308                        ast::pass_visitor_stats.max = Stats::Counters::build<Stats::Counters::MaxCounter<double>>("Max depth - New");
    317309                }
    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
    329311                PASS( "Hoist Type Decls", Validate::hoistTypeDecls( transUnit ) );
    330312                // Hoist Type Decls pulls some declarations out of contexts where
     
    333315                forceFillCodeLocations( transUnit );
    334316
     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 ) );
    335324                PASS( "Replace Typedefs", Validate::replaceTypedef( transUnit ) );
    336325                PASS( "Fix Return Types", Validate::fixReturnTypes( transUnit ) );
     
    474463                if ( errorp ) {
    475464                        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                        }
    477472                        cerr << endl << "---End of AST, begin error message:---\n" << endl;
    478473                } // if
     
    578573        { "rproto", resolvprotop, true, "resolver-proto instance" },
    579574        { "rsteps", resolvep, true, "print resolver steps" },
    580         { "tree", parsep, true, "print parse tree" },
    581575        // code dumps
    582576        { "ast", astp, true, "print AST after parsing" },
Note: See TracChangeset for help on using the changeset viewer.