Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main.cc

    rb4f8808 re0bd0f9  
    1010// Created On       : Fri May 15 23:12:02 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Aug 23 06:50:08 2019
    13 // Update Count     : 607
     12// Last Modified On : Thu Aug 22 13:06:18 2019
     13// Update Count     : 605
    1414//
    1515
     
    1717#include <execinfo.h>                       // for backtrace, backtrace_symbols
    1818#include <getopt.h>                         // for no_argument, optind, geto...
     19#include <signal.h>                         // for signal, SIGABRT, SIGSEGV
    1920#include <cassert>                          // for assertf
    2021#include <cstdio>                           // for fopen, FILE, fclose, stdin
    2122#include <cstdlib>                          // for exit, free, abort, EXIT_F...
    22 #include <csignal>                         // for signal, SIGABRT, SIGSEGV
    2323#include <cstring>                          // for index
    2424#include <fstream>                          // for ofstream
     
    5959#include "ResolvExpr/Resolver.h"            // for resolve
    6060#include "SymTab/Validate.h"                // for validate
     61#include "SynTree/TopLvalue.h"              // for assertTopLvalue, clearInn...
    6162#include "SynTree/Declaration.h"            // for Declaration
    6263#include "SynTree/Visitor.h"                // for acceptAll
     
    9596DeclarationNode * parseTree = nullptr;                                  // program parse tree
    9697
    97 static bool waiting_for_gdb = false;                                    // flag to set cfa-cpp to wait for gdb on start
    98 
    9998static std::string PreludeDirector = "";
    10099
     
    168167} // sigAbortHandler
    169168
     169
    170170int main( int argc, char * argv[] ) {
    171171        FILE * input;                                                                           // use FILE rather than istream because yyin is FILE
     
    184184        parse_cmdline( argc, argv );                                            // process command-line arguments
    185185        CodeGen::FixMain::setReplaceMain( !nomainp );
    186 
    187         if ( waiting_for_gdb ) {
    188                 std::cerr << "Waiting for gdb" << std::endl;
    189                 std::cerr << "run :" << std::endl;
    190                 std::cerr << "  gdb attach " << getpid() << std::endl;
    191                 raise(SIGSTOP);
    192         } // if
    193186
    194187        try {
     
    258251                Stats::Time::StopBlock();
    259252
     253                //std::cerr << "Post-Parse Check" << std::endl;
     254                clearInnerLvalue( translationUnit );
     255                assertTopLvalue( translationUnit );
     256
    260257                // add the assignment statement after the initialization of a type parameter
    261258                PASS( "Validate", SymTab::validate( translationUnit, symtabp ) );
     
    276273                } // if
    277274
     275                assertTopLvalue( translationUnit );
    278276                PASS( "Fix Labels", ControlStruct::fixLabels( translationUnit ) );
     277                assertTopLvalue( translationUnit );
    279278                PASS( "Fix Names", CodeGen::fixNames( translationUnit ) );
     279                assertTopLvalue( translationUnit );
    280280                PASS( "Gen Init", InitTweak::genInit( translationUnit ) );
     281                assertTopLvalue( translationUnit );
    281282                PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) );
     283                assertTopLvalue( translationUnit );
    282284                if ( libcfap ) {
    283285                        // generate the bodies of cfa library functions
     
    303305                } // if
    304306
     307                assertTopLvalue( translationUnit );
     308
    305309                PASS( "Resolve", ResolvExpr::resolve( translationUnit ) );
    306310                if ( exprp ) {
     
    309313                } // if
    310314
     315                clearInnerLvalue( translationUnit );
     316                assertTopLvalue( translationUnit );
     317
    311318                // fix ObjectDecl - replaces ConstructorInit nodes
    312319                PASS( "Fix Init", InitTweak::fix( translationUnit, buildingLibrary() ) );
     320                clearInnerLvalue( translationUnit );
     321                assertTopLvalue( translationUnit );
    313322                if ( ctorinitp ) {
    314323                        dump ( translationUnit );
     
    317326
    318327                PASS( "Expand Unique Expr", Tuples::expandUniqueExpr( translationUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
     328                assertTopLvalue( translationUnit );
    319329
    320330                PASS( "Translate EHM" , ControlStruct::translateEHM( translationUnit ) );
     331                assertTopLvalue( translationUnit );
    321332
    322333                PASS( "Gen Waitfor" , Concurrency::generateWaitFor( translationUnit ) );
     334                clearInnerLvalue( translationUnit );
     335                assertTopLvalue( translationUnit );
    323336
    324337                PASS( "Convert Specializations",  GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded
     338                clearInnerLvalue( translationUnit );
     339                assertTopLvalue( translationUnit );
    325340
    326341                PASS( "Expand Tuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this?
     342                assertTopLvalue( translationUnit );
    327343
    328344                if ( tuplep ) {
     
    332348
    333349                PASS( "Virtual Expand Casts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM
     350                assertTopLvalue( translationUnit );
    334351
    335352                PASS( "Instantiate Generics", GenPoly::instantiateGeneric( translationUnit ) );
     
    338355                        return EXIT_SUCCESS;
    339356                } // if
    340 
     357                clearInnerLvalue( translationUnit );
     358                assertTopLvalue( translationUnit );
    341359                PASS( "Convert L-Value", GenPoly::convertLvalue( translationUnit ) );
     360                clearInnerLvalue( translationUnit );
     361                assertTopLvalue( translationUnit );
    342362
    343363                if ( bboxp ) {
     
    346366                } // if
    347367                PASS( "Box", GenPoly::box( translationUnit ) );
     368                clearInnerLvalue( translationUnit );
     369                assertTopLvalue( translationUnit );
    348370
    349371                if ( bcodegenp ) {
     
    357379
    358380                CodeTools::fillLocations( translationUnit );
     381                assertTopLvalue( translationUnit );
    359382                PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! genproto, prettycodegenp, true, linemarks ) );
    360383
     
    422445        { "statistics", required_argument, nullptr, 'S' },
    423446        { "tree", no_argument, nullptr, 't' },
    424         { "gdb", no_argument, nullptr, 'g' },
    425447        { "", no_argument, nullptr, 0 },                                        // -w
    426448        { "", no_argument, nullptr, 0 },                                        // -W
     
    440462        "<directory> prelude directory for debug/nodebug",      // no flag
    441463        "<option-list> enable profiling information:\n          counters,heap,time,all,none", // -S
    442         "building cfa standard lib",                                                                    // -t
    443         "wait for gdb to attach",                                                                       // -g
     464        "build in tree",                                                                        // -t
    444465        "",                                                                                                     // -w
    445466        "",                                                                                                     // -W
     
    551572                        Stats::parse_params( optarg );
    552573                        break;
    553                   case 't':                                                                             // building cfa stdlib
     574                  case 't':                                                                             // build in tree
    554575                        treep = true;
    555                         break;
    556                   case 'g':                                                                             // wait for gdb
    557                         waiting_for_gdb = true;
    558576                        break;
    559577                  case 'w':                                                                             // suppress all warnings, hidden
Note: See TracChangeset for help on using the changeset viewer.