source: src/main.cc @ ae47a23

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 ae47a23 was ae47a23, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

use getopt_long for pretty print, and update error message

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