Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main.cc

    rfaf8857 rca1c11f  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // main.cc -- 
     7// main.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Fri May 15 23:12:02 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Dec 17 12:59:06 2015
    13 // Update Count     : 179
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Tue Jan 19 16:28:13 2016
     13// Update Count     : 194
    1414//
    1515
     
    4242#include "InitTweak/Mutate.h"
    4343#include "InitTweak/RemoveInit.h"
     44#include "InitTweak/FixInit.h"
    4445//#include "Explain/GenProlog.h"
    4546//#include "Try/Visit.h"
     
    6162        astp = false,
    6263        bresolvep = false,
     64        ctorinitp = false,
    6365        exprp = false,
    6466        expraltp = false,
     
    7476        codegenp = false;
    7577
    76 enum { Ast, Bresolver, Expr, ExprAlt, Grammar, LibCFA, Nopreamble, Parse, Prototypes, Resolver, Symbol, Validate, };
     78enum { Ast, Bresolver, CtorInitFix, Expr, ExprAlt, Grammar, LibCFA, Nopreamble, Parse, Prototypes, Resolver, Symbol, Validate, };
    7779
    7880static struct option long_opts[] = {
    7981        { "ast", no_argument, 0, Ast },
    8082        { "before-resolver", no_argument, 0, Bresolver },
     83        { "ctorinitfix", no_argument, 0, CtorInitFix },
    8184        { "expr", no_argument, 0, Expr },
    8285        { "expralt", no_argument, 0, ExprAlt },
     
    99102
    100103        opterr = 0;                                                                                     // prevent getopt from printing error messages
    101        
     104
    102105        int c;
    103         while ( (c = getopt_long( argc, argv, "abefglnpqrsvyzD:", long_opts, &long_index )) != -1 ) {
     106        while ( (c = getopt_long( argc, argv, "abcefFglnpqrsvyzD:", long_opts, &long_index )) != -1 ) {
    104107                switch ( c ) {
    105108                  case Ast:
     
    110113                  case 'b':                                                                             // print before resolver steps
    111114                        bresolvep = true;
     115                        break;
     116                        case CtorInitFix:
     117                        case 'c':
     118                        ctorinitp = true;
    112119                        break;
    113120                  case Expr:
     
    182189                        output = new ofstream( argv[ optind ] );
    183190                } // if
    184        
     191
    185192                Parser::get_parser().set_debug( grammarp );
    186193
     
    203210                                        exit( 1 );
    204211                                } // if
    205                    
     212
    206213                                parse( prelude, LinkageSpec::Intrinsic );
    207214                        } // if
    208215                } // if
    209216
    210                 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp );     
    211  
     217                parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp );
     218
    212219                if ( parsep ) {
    213220                        Parser::get_parser().get_parseTree()->printList( std::cout );
     
    244251                OPTPRINT( "mutate" )
    245252                ControlStruct::mutate( translationUnit );
    246                 OPTPRINT( "fixNames" ) 
     253                OPTPRINT( "fixNames" )
    247254                CodeGen::fixNames( translationUnit );
    248                 OPTPRINT( "tweak" )
     255                OPTPRINT( "tweakInit" )
    249256                InitTweak::tweak( translationUnit );
    250257
     
    263270                if ( exprp ) {
    264271                        dump( translationUnit );
     272                        return 0;
     273                }
     274
     275                OPTPRINT( "fixInit" )
     276                // fix ObjectDecl - replaces ConstructorInit nodes
     277                InitTweak::fix( translationUnit );
     278                if ( ctorinitp ) {
     279                        dump ( translationUnit );
     280                        return 0;
    265281                }
    266282
     
    331347        std::list< Declaration * > decls;
    332348        if ( noprotop ) {
    333                 filter( translationUnit.begin(), translationUnit.end(), 
     349                filter( translationUnit.begin(), translationUnit.end(),
    334350                                std::back_inserter( decls ), notPrelude );
    335351        } else {
Note: See TracChangeset for help on using the changeset viewer.