Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main.cc

    r37fe352 re523b07  
    2828#include <string>                           // for char_traits, operator<<
    2929
     30#include "CompilationState.h"
    3031#include "../config.h"                      // for CFA_LIBDIR
    3132#include "CodeGen/FixMain.h"                // for FixMain
     
    3334#include "CodeGen/Generate.h"               // for generate
    3435#include "CodeTools/DeclStats.h"            // for printDeclStats
     36#include "CodeTools/ResolvProtoDump.h"      // for dumpAsResolvProto
    3537#include "CodeTools/TrackLoc.h"             // for fillLocations
    3638#include "Common/CompilerError.h"           // for CompilerError
     
    7274DeclarationNode * parseTree = nullptr;                                  // program parse tree
    7375
    74 extern int yydebug;                                                                             // set for -g flag (Grammar)
    75 bool
    76         astp = false,
    77         bresolvep = false,
    78         bboxp = false,
    79         bcodegenp = false,
    80         ctorinitp = false,
    81         declstatsp = false,
    82         exprp = false,
    83         expraltp = false,
    84         genericsp = false,
    85         libcfap = false,
    86         nopreludep = false,
    87         noprotop = false,
    88         nomainp = false,
    89         parsep = false,
    90         resolvep = false,                                                                       // used in AlternativeFinder
    91         symtabp = false,
    92         treep = false,
    93         tuplep = false,
    94         validp = false,
    95         errorp = false,
    96         codegenp = false,
    97         prettycodegenp = false,
    98         linemarks = false;
    99 
    10076std::string PreludeDirector = "";
    10177
     
    196172                        if ( filename == nullptr ) filename = argv[ optind ];
    197173                        // prelude filename comes in differently
    198                         if ( libcfap ) filename = "prelude.cf";
     174                        if ( libcfap ) filename = "prelude.cfa";
    199175                        optind += 1;
    200176                } else {                                                                                // no input file name
     
    223199                        if ( ! libcfap ) {
    224200                                // read the prelude in, if not generating the cfa library
    225                                 FILE * prelude = fopen( (PreludeDirector + "/prelude.cf").c_str(), "r" );
    226                                 assertf( prelude, "cannot open prelude.cf\n" );
     201                                FILE * prelude = fopen( (PreludeDirector + "/prelude.cfa").c_str(), "r" );
     202                                assertf( prelude, "cannot open prelude.cfa\n" );
    227203                                parse( prelude, LinkageSpec::Intrinsic );
    228204
     
    296272                CodeTools::fillLocations( translationUnit );
    297273
     274                if ( resolvprotop ) {
     275                        CodeTools::dumpAsResolvProto( translationUnit );
     276                        return 0;
     277                }
     278
    298279                PASS( "resolve", ResolvExpr::resolve( translationUnit ) );
    299280                if ( exprp ) {
     
    303284
    304285                // fix ObjectDecl - replaces ConstructorInit nodes
    305                 PASS( "fixInit", InitTweak::fix( translationUnit, filename, libcfap || treep ) );
     286                PASS( "fixInit", InitTweak::fix( translationUnit, buildingLibrary() ) );
    306287                if ( ctorinitp ) {
    307288                        dump ( translationUnit );
     
    401382
    402383void parse_cmdline( int argc, char * argv[], const char *& filename ) {
    403         enum { Ast, Bbox, Bresolver, CtorInitFix, DeclStats, Expr, ExprAlt, Grammar, LibCFA, Linemarks, Nolinemarks, Nopreamble, Parse, PreludeDir, Prototypes, Resolver, Symbol, Tree, TupleExpansion, Validate, };
     384        enum { Ast, Bbox, Bresolver, CtorInitFix, DeclStats, Expr, ExprAlt, Grammar, LibCFA, Linemarks, Nolinemarks, Nopreamble, Parse, PreludeDir, Prototypes, Resolver, ResolvProto, Symbol, Tree, TupleExpansion, Validate, };
    404385
    405386        static struct option long_opts[] = {
     
    420401                { "no-prototypes", no_argument, 0, Prototypes },
    421402                { "resolver", no_argument, 0, Resolver },
     403                { "resolv-proto", no_argument, 0, ResolvProto },
    422404                { "symbol", no_argument, 0, Symbol },
    423405                { "tree", no_argument, 0, Tree },
     
    432414        bool Wsuppress = false, Werror = false;
    433415        int c;
    434         while ( (c = getopt_long( argc, argv, "abBcCdefgGlLmnNpqrstTvwW:yzZD:F:", long_opts, &long_index )) != -1 ) {
     416        while ( (c = getopt_long( argc, argv, "abBcCdefgGlLmnNpqrRstTvwW:yzZD:F:", long_opts, &long_index )) != -1 ) {
    435417                switch ( c ) {
    436418                  case Ast:
     
    504486                  case 'r':                                                                             // print resolver steps
    505487                        resolvep = true;
     488                        break;
     489                        case 'R':                                                                               // dump resolv-proto instance
     490                        resolvprotop = true;
    506491                        break;
    507492                  case Symbol:
Note: See TracChangeset for help on using the changeset viewer.