source: src/main.cc @ fa4805f

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since fa4805f was fa4805f, checked in by Andrew Beach <ajbeach@…>, 7 years ago

The builtins.cf now includes exception handling functions.

  • Property mode set to 100644
File size: 15.9 KB
RevLine 
[c850687]1
[b87a5ed]2//
3// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
4//
5// The contents of this file are covered under the licence agreement in the
6// file "LICENCE" distributed with Cforall.
7//
[71f4e4f]8// main.cc --
[b87a5ed]9//
[843054c2]10// Author           : Richard C. Bilson
[b87a5ed]11// Created On       : Fri May 15 23:12:02 2015
[c850687]12// Last Modified By : Andrew Beach
[fa4805f]13// Last Modified On : Wed Jun 28 15:34:00 2017
14// Update Count     : 438
[b87a5ed]15//
16
[51b7345]17#include <iostream>
18#include <fstream>
[e6955b1]19#include <signal.h>                                                                             // signal
20#include <getopt.h>                                                                             // getopt
[0afffee]21#include <execinfo.h>                                                                   // backtrace, backtrace_symbols
[e6955b1]22#include <cxxabi.h>                                                                             // __cxa_demangle
[0afffee]23#include <cstring>                                                                              // index
[e6955b1]24
25using namespace std;
26
[0da3e2c]27#include "Parser/lex.h"
28#include "Parser/parser.h"
29#include "Parser/TypedefTable.h"
[51b7345]30#include "GenPoly/Lvalue.h"
31#include "GenPoly/Specialize.h"
32#include "GenPoly/Box.h"
33#include "GenPoly/CopyParams.h"
[ea5daeb]34#include "GenPoly/InstantiateGeneric.h"
[64adb03]35#include "Concurrency/Keywords.h"
[51b7345]36#include "CodeGen/Generate.h"
37#include "CodeGen/FixNames.h"
[13de47bc]38#include "CodeGen/FixMain.h"
[41a7137]39#include "CodeTools/DeclStats.h"
[4810867]40#include "CodeTools/TrackLoc.h"
[51b7345]41#include "ControlStruct/Mutate.h"
42#include "SymTab/Validate.h"
43#include "ResolvExpr/AlternativePrinter.h"
44#include "ResolvExpr/Resolver.h"
45#include "MakeLibCfa.h"
[a0fdbd5]46#include "InitTweak/GenInit.h"
[71f4e4f]47#include "InitTweak/FixInit.h"
[d3b7937]48#include "Common/UnimplementedError.h"
[51b7345]49#include "../config.h"
[6eb8948]50#include "Tuples/Tuples.h"
[51b7345]51
52using namespace std;
53
[e6955b1]54#define OPTPRINT(x) if ( errorp ) cerr << x << endl;
[81419b5]55
[0da3e2c]56
[8b7ee09]57LinkageSpec::Spec linkage = LinkageSpec::Cforall;
[0da3e2c]58TypedefTable typedefTable;
[cbaee0d]59DeclarationNode * parseTree = nullptr;                                  // program parse tree
[81419b5]60
[926af74]61extern int yydebug;                                                                             // set for -g flag (Grammar)
[b87a5ed]62bool
63        astp = false,
[de62360d]64        bresolvep = false,
[fea7ca7]65        bboxp = false,
[8905f56]66        bcodegenp = false,
[ca1c11f]67        ctorinitp = false,
[41a7137]68        declstatsp = false,
[b87a5ed]69        exprp = false,
70        expraltp = false,
71        libcfap = false,
[de62360d]72        nopreludep = false,
[1ab4ce2]73        noprotop = false,
[3fe34ae]74        nomainp = false,
[de62360d]75        parsep = false,
[b87a5ed]76        resolvep = false,                                                                       // used in AlternativeFinder
77        symtabp = false,
[d3b7937]78        treep = false,
[626dbc10]79        tuplep = false,
[b87a5ed]80        validp = false,
[de62360d]81        errorp = false,
[35b1bf4]82        codegenp = false,
[c850687]83        prettycodegenp = false,
84        nolinemarks = false;
[b87a5ed]85
[926af74]86static void parse_cmdline( int argc, char *argv[], const char *& filename );
[8b7ee09]87static void parse( FILE * input, LinkageSpec::Spec linkage, bool shouldExit = false );
[e6955b1]88static void dump( list< Declaration * > & translationUnit, ostream & out = cout );
89
[0afffee]90static void backtrace( int start ) {                                    // skip first N stack frames
[e6955b1]91        enum { Frames = 50 };
92        void * array[Frames];
[0afffee]93        int size = ::backtrace( array, Frames );
94        char ** messages = ::backtrace_symbols( array, size ); // does not demangle names
95
96        *index( messages[0], '(' ) = '\0';                                      // find executable name
97        cerr << "Stack back trace for: " << messages[0] << endl;
[e6955b1]98
[b542bfb]99        // skip last 2 stack frames after main
100        for ( int i = start; i < size - 2 && messages != nullptr; i += 1 ) {
[e6955b1]101                char * mangled_name = nullptr, * offset_begin = nullptr, * offset_end = nullptr;
102                for ( char *p = messages[i]; *p; ++p ) {        // find parantheses and +offset
[0afffee]103                        if ( *p == '(' ) {
[46f6134]104                                mangled_name = p;
[0afffee]105                        } else if ( *p == '+' ) {
[e6955b1]106                                offset_begin = p;
[0afffee]107                        } else if ( *p == ')' ) {
[e6955b1]108                                offset_end = p;
109                                break;
110                        } // if
111                } // for
112
113                // if line contains symbol, attempt to demangle
[b542bfb]114                int frameNo = i - start;
[e6955b1]115                if ( mangled_name && offset_begin && offset_end && mangled_name < offset_begin ) {
[0afffee]116                        *mangled_name++ = '\0';                                         // delimit strings
[e6955b1]117                        *offset_begin++ = '\0';
118                        *offset_end++ = '\0';
119
[0afffee]120                        int status;
[e6955b1]121                        char * real_name = __cxxabiv1::__cxa_demangle( mangled_name, 0, 0, &status );
[0afffee]122                        // bug in __cxa_demangle for single-character lower-case non-mangled names
[e6955b1]123                        if ( status == 0 ) {                                            // demangling successful ?
[b542bfb]124                                cerr << "(" << frameNo << ") " << messages[i] << " : "
[e6955b1]125                                         << real_name << "+" << offset_begin << offset_end << endl;
126                        } else {                                                                        // otherwise, output mangled name
[b542bfb]127                                cerr << "(" << frameNo << ") " << messages[i] << " : "
[0afffee]128                                         << mangled_name << "(/*unknown*/)+" << offset_begin << offset_end << endl;
[e6955b1]129                        } // if
[0afffee]130
[e6955b1]131                        free( real_name );
132                } else {                                                                                // otherwise, print the whole line
[b542bfb]133                        cerr << "(" << frameNo << ") " << messages[i] << endl;
[e6955b1]134                } // if
135        } // for
[b542bfb]136
[e6955b1]137        free( messages );
[b542bfb]138} // backtrace
139
140void sigSegvBusHandler( int sig_num ) {
141        cerr << "*CFA runtime error* program cfa-cpp terminated with "
142                 <<     (sig_num == SIGSEGV ? "segment fault" : "bus error")
[0afffee]143                 << "." << endl;
[b542bfb]144        backtrace( 2 );                                                                         // skip first 2 stack frames
[e6955b1]145        exit( EXIT_FAILURE );
146} // sigSegvBusHandler
[0da3e2c]147
[b3c36f4]148void sigAbortHandler( __attribute__((unused)) int sig_num ) {
[b542bfb]149        backtrace( 6 );                                                                         // skip first 6 stack frames
150        signal( SIGABRT, SIG_DFL);                                                      // reset default signal handler
151    raise( SIGABRT );                                                                   // reraise SIGABRT
152} // sigAbortHandler
153
154
[cbaee0d]155int main( int argc, char * argv[] ) {
[3b8e52c]156        FILE * input;                                                                           // use FILE rather than istream because yyin is FILE
[e6955b1]157        ostream *output = & cout;
[926af74]158        const char *filename = nullptr;
[e6955b1]159        list< Declaration * > translationUnit;
160
161        signal( SIGSEGV, sigSegvBusHandler );
162        signal( SIGBUS, sigSegvBusHandler );
[b542bfb]163        signal( SIGABRT, sigAbortHandler );
[b87a5ed]164
[0da3e2c]165        parse_cmdline( argc, argv, filename );                          // process command-line arguments
[13de47bc]166        CodeGen::FixMain::setReplaceMain( !nomainp );
[b87a5ed]167
168        try {
[81419b5]169                // choose to read the program from a file or stdin
[3b8e52c]170                if ( optind < argc ) {                                                  // any commands after the flags ? => input file name
[b87a5ed]171                        input = fopen( argv[ optind ], "r" );
[3b8e52c]172                        assertf( input, "cannot open %s\n", argv[ optind ] );
[d029162]173                        // if running cfa-cpp directly, might forget to pass -F option (and really shouldn't have to)
[926af74]174                        if ( filename == nullptr ) filename = argv[ optind ];
[37024fd]175                        // prelude filename comes in differently
176                        if ( libcfap ) filename = "prelude.cf";
[b87a5ed]177                        optind += 1;
[3b8e52c]178                } else {                                                                                // no input file name
[b87a5ed]179                        input = stdin;
[2a7e29b]180                        // if running cfa-cpp directly, might forget to pass -F option. Since this takes from stdin, pass
181                        // a fake name along
[926af74]182                        if ( filename == nullptr ) filename = "stdin";
[b87a5ed]183                } // if
184
[159c62e]185                // read in the builtins, extras, and the prelude
[de62360d]186                if ( ! nopreludep ) {                                                   // include gcc builtins
[faf8857]187                        // -l is for initial build ONLY and builtins.cf is not in the lib directory so access it here.
[807ce84]188
189                        // Read to gcc builtins, if not generating the cfa library
[6ce3ae9]190                        FILE * gcc_builtins = fopen( libcfap | treep ? "../prelude/gcc-builtins.cf" : CFA_LIBDIR "/gcc-builtins.cf", "r" );
191                        assertf( gcc_builtins, "cannot open gcc-builtins.cf\n" );
192                        parse( gcc_builtins, LinkageSpec::Compiler );
[81419b5]193
[159c62e]194                        // read the extra prelude in, if not generating the cfa library
[375a068]195                        FILE * extras = fopen( libcfap | treep ? "../prelude/extras.cf" : CFA_LIBDIR "/extras.cf", "r" );
[3b8e52c]196                        assertf( extras, "cannot open extras.cf\n" );
[159c62e]197                        parse( extras, LinkageSpec::C );
198
[81419b5]199                        if ( ! libcfap ) {
[faf8857]200                                // read the prelude in, if not generating the cfa library
[375a068]201                                FILE * prelude = fopen( treep ? "../prelude/prelude.cf" : CFA_LIBDIR "/prelude.cf", "r" );
[3b8e52c]202                                assertf( prelude, "cannot open prelude.cf\n" );
[35304009]203                                parse( prelude, LinkageSpec::Intrinsic );
[fa4805f]204
205                                // Read to cfa builtins, if not generating the cfa library
206                                FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" );
207                                assertf( builtins, "cannot open builtins.cf\n" );
208                                parse( builtins, LinkageSpec::Builtin );
[b87a5ed]209                        } // if
210                } // if
[81419b5]211
[926af74]212                parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, yydebug );
[71f4e4f]213
[b87a5ed]214                if ( parsep ) {
[e6955b1]215                        parseTree->printList( cout );
[0da3e2c]216                        delete parseTree;
[b87a5ed]217                        return 0;
218                } // if
219
[0da3e2c]220                buildList( parseTree, translationUnit );
221                delete parseTree;
[cbaee0d]222                parseTree = nullptr;
[b87a5ed]223
224                if ( astp ) {
[1ab4ce2]225                        dump( translationUnit );
[b87a5ed]226                        return 0;
227                } // if
228
[bcda04c]229                // OPTPRINT( "Concurrency" )
230                // Concurrency::applyKeywords( translationUnit );
231
[839ccbb]232                // add the assignment statement after the initialization of a type parameter
[81419b5]233                OPTPRINT( "validate" )
234                SymTab::validate( translationUnit, symtabp );
235                if ( symtabp ) {
[46f6134]236                        deleteAll( translationUnit );
[b87a5ed]237                        return 0;
238                } // if
239
[81419b5]240                if ( expraltp ) {
[e6955b1]241                        ResolvExpr::AlternativePrinter printer( cout );
[81419b5]242                        acceptAll( translationUnit, printer );
[b87a5ed]243                        return 0;
244                } // if
245
246                if ( validp ) {
[1ab4ce2]247                        dump( translationUnit );
[b87a5ed]248                        return 0;
249                } // if
250
[81419b5]251                OPTPRINT( "mutate" )
252                ControlStruct::mutate( translationUnit );
[71f4e4f]253                OPTPRINT( "fixNames" )
[81419b5]254                CodeGen::fixNames( translationUnit );
[ef42b143]255                OPTPRINT( "genInit" )
[a0fdbd5]256                InitTweak::genInit( translationUnit );
[bf32bb8]257                OPTPRINT( "expandMemberTuples" );
258                Tuples::expandMemberTuples( translationUnit );
[81419b5]259                if ( libcfap ) {
260                        // generate the bodies of cfa library functions
261                        LibCfa::makeLibCfa( translationUnit );
[b87a5ed]262                } // if
263
[fa2de95]264                if ( declstatsp ) {
265                        CodeTools::printDeclStats( translationUnit );
266                        deleteAll( translationUnit );
267                        return 0;
268                }
269
[de62360d]270                if ( bresolvep ) {
[1ab4ce2]271                        dump( translationUnit );
[de62360d]272                        return 0;
273                } // if
274
[81419b5]275                OPTPRINT( "resolve" )
[b87a5ed]276                ResolvExpr::resolve( translationUnit );
[81419b5]277                if ( exprp ) {
[1ab4ce2]278                        dump( translationUnit );
[ca1c11f]279                        return 0;
[926af74]280                } // if
[81419b5]281
[71f4e4f]282                // fix ObjectDecl - replaces ConstructorInit nodes
[6cf27a07]283                OPTPRINT( "fixInit" )
284                InitTweak::fix( translationUnit, filename, libcfap || treep );
[ca1c11f]285                if ( ctorinitp ) {
286                        dump ( translationUnit );
287                        return 0;
[926af74]288                } // if
[71f4e4f]289
[141b786]290                OPTPRINT( "expandUniqueExpr" ); // xxx - is this the right place for this? want to expand ASAP so that subsequent 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
291                Tuples::expandUniqueExpr( translationUnit );
[626dbc10]292
293                OPTPRINT( "convertSpecializations" ) // needs to happen before tuple types are expanded
294                GenPoly::convertSpecializations( translationUnit );
295
[d9fa60a]296                OPTPRINT( "expandTuples" ); // xxx - is this the right place for this?
297                Tuples::expandTuples( translationUnit );
[626dbc10]298                if ( tuplep ) {
299                        dump( translationUnit );
300                        return 0;
301                }
[141b786]302
[ea5daeb]303                OPTPRINT("instantiateGenerics")
304                GenPoly::instantiateGeneric( translationUnit );
[81419b5]305                OPTPRINT( "copyParams" );
[b87a5ed]306                GenPoly::copyParams( translationUnit );
[81419b5]307                OPTPRINT( "convertLvalue" )
[b87a5ed]308                GenPoly::convertLvalue( translationUnit );
[fea7ca7]309
310                if ( bboxp ) {
311                        dump( translationUnit );
312                        return 0;
[926af74]313                } // if
[81419b5]314                OPTPRINT( "box" )
[b87a5ed]315                GenPoly::box( translationUnit );
[81419b5]316
[8905f56]317                if ( bcodegenp ) {
318                        dump( translationUnit );
319                        return 0;
320                }
321
[13de47bc]322                if ( optind < argc ) {                                                  // any commands after the flags and input file ? => output file name
323                        output = new ofstream( argv[ optind ] );
324                } // if
[0270824]325
[7b15d7a]326                CodeTools::fillLocations( translationUnit );
[c850687]327                CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, ! nolinemarks );
[0270824]328
[13de47bc]329                CodeGen::FixMain::fix( *output, treep ? "../prelude/bootloader.c" : CFA_LIBDIR "/bootloader.c" );
[0270824]330
[e6955b1]331                if ( output != &cout ) {
[b87a5ed]332                        delete output;
333                } // if
334        } catch ( SemanticError &e ) {
335                if ( errorp ) {
[e6955b1]336                        cerr << "---AST at error:---" << endl;
337                        dump( translationUnit, cerr );
338                        cerr << endl << "---End of AST, begin error message:---\n" << endl;
[926af74]339                } // if
[e6955b1]340                e.print( cerr );
341                if ( output != &cout ) {
[b87a5ed]342                        delete output;
343                } // if
344                return 1;
345        } catch ( UnimplementedError &e ) {
[e6955b1]346                cout << "Sorry, " << e.get_what() << " is not currently implemented" << endl;
347                if ( output != &cout ) {
[b87a5ed]348                        delete output;
349                } // if
350                return 1;
351        } catch ( CompilerError &e ) {
[e6955b1]352                cerr << "Compiler Error: " << e.get_what() << endl;
[c850687]353                cerr << "(please report bugs to [REDACTED])" << endl;
[e6955b1]354                if ( output != &cout ) {
[b87a5ed]355                        delete output;
356                } // if
357                return 1;
358        } // try
359
[39786813]360        deleteAll( translationUnit );
[b87a5ed]361        return 0;
[d9a0e76]362} // main
[51b7345]363
[cbaee0d]364void parse_cmdline( int argc, char * argv[], const char *& filename ) {
[41a7137]365        enum { Ast, Bbox, Bresolver, CtorInitFix, DeclStats, Expr, ExprAlt, Grammar, LibCFA, Nopreamble, Parse, Prototypes, Resolver, Symbol, Tree, TupleExpansion, Validate, };
[0da3e2c]366
367        static struct option long_opts[] = {
368                { "ast", no_argument, 0, Ast },
369                { "before-box", no_argument, 0, Bbox },
370                { "before-resolver", no_argument, 0, Bresolver },
371                { "ctorinitfix", no_argument, 0, CtorInitFix },
[41a7137]372                { "decl-stats", no_argument, 0, DeclStats },
[0da3e2c]373                { "expr", no_argument, 0, Expr },
374                { "expralt", no_argument, 0, ExprAlt },
375                { "grammar", no_argument, 0, Grammar },
376                { "libcfa", no_argument, 0, LibCFA },
377                { "no-preamble", no_argument, 0, Nopreamble },
378                { "parse", no_argument, 0, Parse },
379                { "no-prototypes", no_argument, 0, Prototypes },
380                { "resolver", no_argument, 0, Resolver },
381                { "symbol", no_argument, 0, Symbol },
382                { "tree", no_argument, 0, Tree },
[626dbc10]383                { "tuple-expansion", no_argument, 0, TupleExpansion },
[0da3e2c]384                { "validate", no_argument, 0, Validate },
385                { 0, 0, 0, 0 }
386        }; // long_opts
387        int long_index;
388
389        opterr = 0;                                                                                     // (global) prevent getopt from printing error messages
390
391        int c;
[8905f56]392        while ( (c = getopt_long( argc, argv, "abBcCdefglLmnpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) {
[0da3e2c]393                switch ( c ) {
394                  case Ast:
395                  case 'a':                                                                             // dump AST
396                        astp = true;
397                        break;
398                  case Bresolver:
399                  case 'b':                                                                             // print before resolver steps
400                        bresolvep = true;
401                        break;
[626dbc10]402                  case 'B':                                                                             // print before box steps
[0da3e2c]403                        bboxp = true;
404                        break;
405                  case CtorInitFix:
[e39241b]406                  case 'c':                                                                             // print after constructors and destructors are replaced
[0da3e2c]407                        ctorinitp = true;
408                        break;
[8905f56]409                  case 'C':                                                                             // print before code generation
410                        bcodegenp = true;
411                        break;
[41a7137]412                  case DeclStats:
413                  case 'd':
414                    declstatsp = true;
415                        break;
[0da3e2c]416                  case Expr:
417                  case 'e':                                                                             // dump AST after expression analysis
418                        exprp = true;
419                        break;
420                  case ExprAlt:
421                  case 'f':                                                                             // print alternatives for expressions
422                        expraltp = true;
423                        break;
424                  case Grammar:
425                  case 'g':                                                                             // bison debugging info (grammar rules)
[926af74]426                        yydebug = true;
[0da3e2c]427                        break;
428                  case LibCFA:
429                  case 'l':                                                                             // generate libcfa.c
430                        libcfap = true;
431                        break;
[c850687]432                  case 'L':                                                                             // surpress lines marks
433                        nolinemarks = true;
434                        break;
[0da3e2c]435                  case Nopreamble:
436                  case 'n':                                                                             // do not read preamble
437                        nopreludep = true;
438                        break;
439                  case Prototypes:
440                  case 'p':                                                                             // generate prototypes for preamble functions
441                        noprotop = true;
442                        break;
[3fe34ae]443                  case 'm':                                                                             // don't replace the main
444                        nomainp = true;
445                        break;
[0da3e2c]446                  case Parse:
447                  case 'q':                                                                             // dump parse tree
448                        parsep = true;
449                        break;
450                  case Resolver:
451                  case 'r':                                                                             // print resolver steps
452                        resolvep = true;
453                        break;
454                  case Symbol:
455                  case 's':                                                                             // print symbol table events
456                        symtabp = true;
457                        break;
458                  case Tree:
459                  case 't':                                                                             // build in tree
460                        treep = true;
461                        break;
[626dbc10]462                  case TupleExpansion:
463                  case 'T':                                                                             // print after tuple expansion
464                        tuplep = true;
465                        break;
[0da3e2c]466                  case 'v':                                                                             // dump AST after decl validation pass
467                        validp = true;
468                        break;
[e39241b]469                  case 'y':                                                                             // dump AST on error
[0da3e2c]470                        errorp = true;
471                        break;
[e39241b]472                  case 'z':                                                                             // dump as codegen rather than AST
[0da3e2c]473                        codegenp = true;
[e39241b]474                        break;
475                        case 'Z':                                                                       // prettyprint during codegen (i.e. print unmangled names, etc.)
[35b1bf4]476                        prettycodegenp = true;
[0da3e2c]477                        break;
478                  case 'D':                                                                             // ignore -Dxxx
479                        break;
480                  case 'F':                                                                             // source file-name without suffix
481                        filename = optarg;
482                        break;
483                  case '?':
[3b8e52c]484                        assertf( false, "Unknown option: '%c'\n", (char)optopt );
[0da3e2c]485                  default:
486                        abort();
487                } // switch
488        } // while
489} // parse_cmdline
490
[8b7ee09]491static void parse( FILE * input, LinkageSpec::Spec linkage, bool shouldExit ) {
[0da3e2c]492        extern int yyparse( void );
[cbaee0d]493        extern FILE * yyin;
[0da3e2c]494        extern int yylineno;
495
[8b7ee09]496        ::linkage = linkage;                                                            // set globals
[0da3e2c]497        yyin = input;
498        yylineno = 1;
499        typedefTable.enterScope();
500        int parseStatus = yyparse();
[81419b5]501
502        fclose( input );
[0da3e2c]503        if ( shouldExit || parseStatus != 0 ) {
504                exit( parseStatus );
[81419b5]505        } // if
[0da3e2c]506} // parse
[81419b5]507
[1ab4ce2]508static bool notPrelude( Declaration * decl ) {
509        return ! LinkageSpec::isBuiltin( decl->get_linkage() );
[0da3e2c]510} // notPrelude
[1ab4ce2]511
[e6955b1]512static void dump( list< Declaration * > & translationUnit, ostream & out ) {
513        list< Declaration * > decls;
[926af74]514
[1ab4ce2]515        if ( noprotop ) {
[e6955b1]516                filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), notPrelude );
[1ab4ce2]517        } else {
518                decls = translationUnit;
[926af74]519        } // if
[1ab4ce2]520
[e39241b]521        // depending on commandline options, either generate code or dump the AST
522        if ( codegenp ) {
523                CodeGen::generate( decls, out, ! noprotop, prettycodegenp );
524        } else {
525                printAll( decls, out );
526        }
[7f5566b]527        deleteAll( translationUnit );
[0da3e2c]528} // dump
[1ab4ce2]529
[51b7345]530// Local Variables: //
[b87a5ed]531// tab-width: 4 //
532// mode: c++ //
533// compile-command: "make install" //
[51b7345]534// End:  //
Note: See TracBrowser for help on using the repository browser.