Changeset e39241b for src/main.cc


Ignore:
Timestamp:
Apr 17, 2017, 5:43:01 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
7069652
Parents:
4ae83a4b
Message:

allow codegen as an alternative to AST dump after any pass with the -z option

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main.cc

    r4ae83a4b re39241b  
    304304                GenPoly::box( translationUnit );
    305305
    306                 // print tree right before code generation
    307                 if ( codegenp ) {
    308                         dump( translationUnit );
    309                         return 0;
    310                 } // if
    311 
    312306                if ( optind < argc ) {                                                  // any commands after the flags and input file ? => output file name
    313307                        output = new ofstream( argv[ optind ] );
    314308                } // if
    315309
    316                 CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp );
     310                CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true );
    317311
    318312                CodeGen::FixMain::fix( *output, treep ? "../prelude/bootloader.c" : CFA_LIBDIR "/bootloader.c" );
     
    393387                        break;
    394388                  case CtorInitFix:
    395                   case 'c':
     389                  case 'c':                                                                             // print after constructors and destructors are replaced
    396390                        ctorinitp = true;
    397391                        break;
     
    450444                        validp = true;
    451445                        break;
    452                   case 'y':
     446                  case 'y':                                                                             // dump AST on error
    453447                        errorp = true;
    454448                        break;
    455                   case 'z':
     449                  case 'z':                                                                             // dump as codegen rather than AST
    456450                        codegenp = true;
    457                         case 'Z':
     451                        break;
     452                        case 'Z':                                                                       // prettyprint during codegen (i.e. print unmangled names, etc.)
    458453                        prettycodegenp = true;
    459454                        break;
     
    501496        } // if
    502497
    503         printAll( decls, out );
     498        // depending on commandline options, either generate code or dump the AST
     499        if ( codegenp ) {
     500                CodeGen::generate( decls, out, ! noprotop, prettycodegenp );
     501        } else {
     502                printAll( decls, out );
     503        }
    504504        deleteAll( translationUnit );
    505505} // dump
Note: See TracChangeset for help on using the changeset viewer.