Changes in / [1755226:9bae71f]


Ignore:
Location:
src
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r1755226 r9bae71f  
    443443        void CodeGenerator::postvisit( UntypedExpr * untypedExpr ) {
    444444                extension( untypedExpr );
    445                 if ( NameExpr * nameExpr = dynamic_cast< NameExpr* >( untypedExpr->function ) ) {
     445                if ( NameExpr * nameExpr = dynamic_cast< NameExpr* >( untypedExpr->get_function() ) ) {
    446446                        OperatorInfo opInfo;
    447                         if ( operatorLookup( nameExpr->name, opInfo ) ) {
    448                                 std::list< Expression* >::iterator arg = untypedExpr->args.begin();
     447                        if ( operatorLookup( nameExpr->get_name(), opInfo ) ) {
     448                                std::list< Expression* >::iterator arg = untypedExpr->get_args().begin();
    449449                                switch ( opInfo.type ) {
    450450                                  case OT_INDEX:
    451                                         assert( untypedExpr->args.size() == 2 );
     451                                        assert( untypedExpr->get_args().size() == 2 );
    452452                                        (*arg++)->accept( *visitor );
    453453                                        output << "[";
     
    461461                                  case OT_CTOR:
    462462                                  case OT_DTOR:
    463                                         if ( untypedExpr->args.size() == 1 ) {
     463                                        if ( untypedExpr->get_args().size() == 1 ) {
    464464                                                // the expression fed into a single parameter constructor or destructor may contain side
    465465                                                // effects, so must still output this expression
     
    480480                                                (*arg++)->accept( *visitor );
    481481                                                output << opInfo.symbol << "{ ";
    482                                                 genCommaList( arg, untypedExpr->args.end() );
     482                                                genCommaList( arg, untypedExpr->get_args().end() );
    483483                                                output << "}) /* " << opInfo.inputName << " */";
    484484                                        } // if
     
    488488                                  case OT_PREFIXASSIGN:
    489489                                  case OT_LABELADDRESS:
    490                                         assert( untypedExpr->args.size() == 1 );
     490                                        assert( untypedExpr->get_args().size() == 1 );
    491491                                        output << "(";
    492492                                        output << opInfo.symbol;
     
    497497                                  case OT_POSTFIX:
    498498                                  case OT_POSTFIXASSIGN:
    499                                         assert( untypedExpr->args.size() == 1 );
     499                                        assert( untypedExpr->get_args().size() == 1 );
    500500                                        (*arg)->accept( *visitor );
    501501                                        output << opInfo.symbol;
     
    504504                                  case OT_INFIX:
    505505                                  case OT_INFIXASSIGN:
    506                                         assert( untypedExpr->args.size() == 2 );
     506                                        assert( untypedExpr->get_args().size() == 2 );
    507507                                        output << "(";
    508508                                        (*arg++)->accept( *visitor );
     
    517517                                } // switch
    518518                        } else {
    519                                 // builtin routines
    520                                 nameExpr->accept( *visitor );
    521                                 output << "(";
    522                                 genCommaList( untypedExpr->args.begin(), untypedExpr->args.end() );
    523                                 output << ")";
     519                                if ( nameExpr->get_name() == "..." ) { // case V1 ... V2 or case V1~V2
     520                                        assert( untypedExpr->get_args().size() == 2 );
     521                                        (*untypedExpr->get_args().begin())->accept( *visitor );
     522                                        output << " ... ";
     523                                        (*--untypedExpr->get_args().end())->accept( *visitor );
     524                                } else {                                                                // builtin routines
     525                                        nameExpr->accept( *visitor );
     526                                        output << "(";
     527                                        genCommaList( untypedExpr->get_args().begin(), untypedExpr->get_args().end() );
     528                                        output << ")";
     529                                } // if
    524530                        } // if
    525531                } else {
    526                         untypedExpr->function->accept( *visitor );
     532                        untypedExpr->get_function()->accept( *visitor );
    527533                        output << "(";
    528                         genCommaList( untypedExpr->args.begin(), untypedExpr->args.end() );
     534                        genCommaList( untypedExpr->get_args().begin(), untypedExpr->get_args().end() );
    529535                        output << ")";
    530536                } // if
     
    532538
    533539        void CodeGenerator::postvisit( RangeExpr * rangeExpr ) {
    534                 rangeExpr->low->accept( *visitor );
     540                rangeExpr->get_low()->accept( *visitor );
    535541                output << " ... ";
    536                 rangeExpr->high->accept( *visitor );
     542                rangeExpr->get_high()->accept( *visitor );
    537543        }
    538544
  • src/InitTweak/FixInit.cc

    r1755226 r9bae71f  
    5858#include "SynTree/TypeSubstitution.h"  // for TypeSubstitution, operator<<
    5959#include "SynTree/Visitor.h"           // for acceptAll, maybeAccept
     60#include "Tuples/Tuples.h"             // for isTtype
    6061
    6162bool ctordtorp = false; // print all debug
     
    338339                                } else if ( DeclarationWithType * funcDecl = dynamic_cast< DeclarationWithType * > ( function->get_var() ) ) {
    339340                                        FunctionType * ftype = dynamic_cast< FunctionType * >( GenPoly::getFunctionType( funcDecl->get_type() ) );
    340                                         assertf( ftype, "Function call without function type: %s", toString( funcDecl ).c_str() );
     341                                        assert( ftype );
    341342                                        if ( CodeGen::isConstructor( funcDecl->get_name() ) && ftype->get_parameters().size() == 2 ) {
    342343                                                Type * t1 = getPointerBase( ftype->get_parameters().front()->get_type() );
     
    367368                }
    368369
    369                 bool ResolveCopyCtors::skipCopyConstruct( Type * type ) { return ! isConstructable( type ); }
     370                bool ResolveCopyCtors::skipCopyConstruct( Type * type ) {
     371                        return dynamic_cast< VarArgsType * >( type ) || dynamic_cast< ReferenceType * >( type ) || GenPoly::getFunctionType( type ) || Tuples::isTtype( type );
     372                }
    370373
    371374                Expression * ResolveCopyCtors::makeCtorDtor( const std::string & fname, ObjectDecl * var, Expression * cpArg ) {
     
    816819                                        assert( ! ctorInit->get_ctor() || ! ctorInit->get_init() );
    817820                                        Statement * dtor = ctorInit->get_dtor();
    818                                         // don't need to call intrinsic dtor, because it does nothing, but
    819                                         // non-intrinsic dtors must be called
    820821                                        if ( dtor && ! isIntrinsicSingleArgCallStmt( dtor ) ) {
    821                                                 // set dtor location to the object's location for error messages
    822                                                 ctorInit->dtor->location = objDecl->location;
     822                                                // don't need to call intrinsic dtor, because it does nothing, but
     823                                                // non-intrinsic dtors must be called
    823824                                                reverseDeclOrder.front().push_front( objDecl );
    824825                                        } // if
     
    10111012                                        // skip non-DWT members
    10121013                                        if ( ! field ) continue;
    1013                                         // skip non-constructable members
    1014                                         if ( ! tryConstruct( field ) ) continue;
    10151014                                        // skip handled members
    10161015                                        if ( ! unhandled.count( field ) ) continue;
  • src/InitTweak/GenInit.cc

    r1755226 r9bae71f  
    6262        };
    6363
    64         struct CtorDtor : public WithGuards, public WithShortCircuiting, public WithVisitorRef<CtorDtor>  {
     64        struct CtorDtor : public WithGuards, public WithShortCircuiting  {
    6565                /// create constructor and destructor statements for object declarations.
    6666                /// the actual call statements will be added in after the resolver has run
     
    7575                // that need to be constructed or destructed
    7676                void previsit( StructDecl *aggregateDecl );
    77                 void previsit( AggregateDecl * ) { visit_children = false; }
    78                 void previsit( NamedTypeDecl * ) { visit_children = false; }
    79                 void previsit( FunctionType * ) { visit_children = false; }
     77                void previsit( __attribute__((unused)) UnionDecl    * aggregateDecl ) { visit_children = false; }
     78                void previsit( __attribute__((unused)) EnumDecl     * aggregateDecl ) { visit_children = false; }
     79                void previsit( __attribute__((unused)) TraitDecl    * aggregateDecl ) { visit_children = false; }
     80                void previsit( __attribute__((unused)) TypeDecl     * typeDecl )      { visit_children = false; }
     81                void previsit( __attribute__((unused)) TypedefDecl  * typeDecl )      { visit_children = false; }
     82                void previsit( __attribute__((unused)) FunctionType * funcType )      { visit_children = false; }
    8083
    8184                void previsit( CompoundStmt * compoundStmt );
     
    9396        };
    9497
    95         struct HoistArrayDimension final : public WithDeclsToAdd, public WithShortCircuiting, public WithGuards {
     98        class HoistArrayDimension final : public GenPoly::DeclMutator {
     99          public:
     100                typedef GenPoly::DeclMutator Parent;
     101
    96102                /// hoist dimension from array types in object declaration so that it uses a single
    97103                /// const variable of type size_t, so that side effecting array dimensions are only
     
    99105                static void hoistArrayDimension( std::list< Declaration * > & translationUnit );
    100106
    101                 void premutate( ObjectDecl * objectDecl );
    102                 DeclarationWithType * postmutate( ObjectDecl * objectDecl );
    103                 void premutate( FunctionDecl *functionDecl );
     107          private:
     108                using Parent::mutate;
     109
     110                virtual DeclarationWithType * mutate( ObjectDecl * objectDecl ) override;
     111                virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ) override;
    104112                // should not traverse into any of these declarations to find objects
    105113                // that need to be constructed or destructed
    106                 void premutate( AggregateDecl * ) { visit_children = false; }
    107                 void premutate( NamedTypeDecl * ) { visit_children = false; }
    108                 void premutate( FunctionType * ) { visit_children = false; }
     114                virtual Declaration* mutate( StructDecl *aggregateDecl ) override { return aggregateDecl; }
     115                virtual Declaration* mutate( UnionDecl *aggregateDecl ) override { return aggregateDecl; }
     116                virtual Declaration* mutate( EnumDecl *aggregateDecl ) override { return aggregateDecl; }
     117                virtual Declaration* mutate( TraitDecl *aggregateDecl ) override { return aggregateDecl; }
     118                virtual TypeDecl* mutate( TypeDecl *typeDecl ) override { return typeDecl; }
     119                virtual Declaration* mutate( TypedefDecl *typeDecl ) override { return typeDecl; }
     120
     121                virtual Type* mutate( FunctionType *funcType ) override { return funcType; }
    109122
    110123                void hoist( Type * type );
     
    115128
    116129        void genInit( std::list< Declaration * > & translationUnit ) {
    117                 fixReturnStatements( translationUnit );
     130                ReturnFixer::makeReturnTemp( translationUnit );
    118131                HoistArrayDimension::hoistArrayDimension( translationUnit );
    119132                CtorDtor::generateCtorDtor( translationUnit );
    120133        }
    121134
    122         void fixReturnStatements( std::list< Declaration * > & translationUnit ) {
     135        void ReturnFixer::makeReturnTemp( std::list< Declaration * > & translationUnit ) {
    123136                PassVisitor<ReturnFixer> fixer;
    124137                mutateAll( translationUnit, fixer );
     
    130143                // hands off if the function returns a reference - we don't want to allocate a temporary if a variable's address
    131144                // is being returned
    132                 if ( returnStmt->get_expr() && returnVals.size() == 1 && isConstructable( returnVals.front()->get_type() ) ) {
     145                if ( returnStmt->get_expr() && returnVals.size() == 1 && ! dynamic_cast< ReferenceType * >( returnVals.front()->get_type() ) ) {
    133146                        // explicitly construct the return value using the return expression and the retVal object
    134147                        assertf( returnVals.front()->get_name() != "", "Function %s has unnamed return value\n", funcName.c_str() );
     
    145158                GuardValue( funcName );
    146159
    147                 ftype = functionDecl->type;
    148                 funcName = functionDecl->name;
     160                ftype = functionDecl->get_functionType();
     161                funcName = functionDecl->get_name();
    149162        }
    150163
     
    152165        // which would be incorrect if it is a side-effecting computation.
    153166        void HoistArrayDimension::hoistArrayDimension( std::list< Declaration * > & translationUnit ) {
    154                 PassVisitor<HoistArrayDimension> hoister;
    155                 mutateAll( translationUnit, hoister );
    156         }
    157 
    158         void HoistArrayDimension::premutate( ObjectDecl * objectDecl ) {
    159                 GuardValue( storageClasses );
     167                HoistArrayDimension hoister;
     168                hoister.mutateDeclarationList( translationUnit );
     169        }
     170
     171        DeclarationWithType * HoistArrayDimension::mutate( ObjectDecl * objectDecl ) {
    160172                storageClasses = objectDecl->get_storageClasses();
    161         }
    162 
    163         DeclarationWithType * HoistArrayDimension::postmutate( ObjectDecl * objectDecl ) {
     173                DeclarationWithType * temp = Parent::mutate( objectDecl );
    164174                hoist( objectDecl->get_type() );
    165                 return objectDecl;
     175                return temp;
    166176        }
    167177
     
    184194
    185195                        arrayType->set_dimension( new VariableExpr( arrayDimension ) );
    186                         declsToAddBefore.push_back( arrayDimension );
     196                        addDeclaration( arrayDimension );
    187197
    188198                        hoist( arrayType->get_base() );
     
    191201        }
    192202
    193         void HoistArrayDimension::premutate( FunctionDecl * ) {
    194                 GuardValue( inFunction );
     203        DeclarationWithType * HoistArrayDimension::mutate( FunctionDecl *functionDecl ) {
     204                ValueGuard< bool > oldInFunc( inFunction );
     205                inFunction = true;
     206                DeclarationWithType * decl = Parent::mutate( functionDecl );
     207                return decl;
    195208        }
    196209
     
    201214
    202215        bool CtorDtor::isManaged( Type * type ) const {
    203                 // references are never constructed
     216                // at least for now, references are never constructed
    204217                if ( dynamic_cast< ReferenceType * >( type ) ) return false;
    205218                // need to clear and reset qualifiers when determining if a type is managed
     
    208221                if ( TupleType * tupleType = dynamic_cast< TupleType * > ( type ) ) {
    209222                        // tuple is also managed if any of its components are managed
    210                         if ( std::any_of( tupleType->types.begin(), tupleType->types.end(), [&](Type * type) { return isManaged( type ); }) ) {
     223                        if ( std::any_of( tupleType->get_types().begin(), tupleType->get_types().end(), [&](Type * type) { return isManaged( type ); }) ) {
    211224                                return true;
    212225                        }
     
    292305
    293306        void CtorDtor::previsit( FunctionDecl *functionDecl ) {
    294                 visit_children = false;  // do not try and construct parameters or forall parameters
    295307                GuardValue( inFunction );
    296308                inFunction = true;
     
    306318                }
    307319
    308                 maybeAccept( functionDecl->get_statements(), *visitor );
     320                PassVisitor<CtorDtor> newCtorDtor;
     321                newCtorDtor.pass = *this;
     322                maybeAccept( functionDecl->get_statements(), newCtorDtor );
     323                visit_children = false;  // do not try and construct parameters or forall parameters - must happen after maybeAccept
    309324        }
    310325
     
    325340        }
    326341
    327         void CtorDtor::previsit( CompoundStmt * ) {
     342        void CtorDtor::previsit( __attribute__((unused)) CompoundStmt * compoundStmt ) {
    328343                GuardScope( managedTypes );
    329344        }
  • src/InitTweak/GenInit.h

    r1755226 r9bae71f  
    2525        void genInit( std::list< Declaration * > & translationUnit );
    2626
    27         /// Converts return statements into copy constructor calls on the hidden return variable
    28         void fixReturnStatements( std::list< Declaration * > & translationUnit );
    29 
    30         /// generates a single ctor/dtor statement using objDecl as the 'this' parameter and arg as the optional argument
    31         ImplicitCtorDtorStmt * genCtorDtor( const std::string & fname, ObjectDecl * objDecl, Expression * arg = nullptr );
     27  /// generates a single ctor/dtor statement using objDecl as the 'this' parameter and arg as the optional argument
     28  ImplicitCtorDtorStmt * genCtorDtor( const std::string & fname, ObjectDecl * objDecl, Expression * arg = nullptr );
    3229
    3330        /// creates an appropriate ConstructorInit node which contains a constructor, destructor, and C-initializer
  • src/InitTweak/InitTweak.cc

    r1755226 r9bae71f  
     1#include <stddef.h>                // for NULL
    12#include <algorithm>               // for find, all_of
    23#include <cassert>                 // for assertf, assert, strict_dynamic_cast
     
    2223#include "SynTree/Type.h"          // for FunctionType, ArrayType, PointerType
    2324#include "SynTree/Visitor.h"       // for Visitor, maybeAccept
    24 #include "Tuples/Tuples.h"         // for Tuples::isTtype
    2525
    2626class UntypedValofExpr;
     
    184184                        callExpr->get_args().splice( callExpr->get_args().end(), args );
    185185
    186                         *out++ = new IfStmt( noLabels, cond, new ExprStmt( noLabels, callExpr ), nullptr );
     186                        *out++ = new IfStmt( noLabels, cond, new ExprStmt( noLabels, callExpr ), NULL );
    187187
    188188                        UntypedExpr * increment = new UntypedExpr( new NameExpr( "++?" ) );
     
    250250        // To accomplish this, generate switch statement, consuming all of expander's elements
    251251        Statement * InitImpl::buildListInit( UntypedExpr * dst, std::list< Expression * > & indices ) {
    252                 if ( ! init ) return nullptr;
     252                if ( ! init ) return NULL;
    253253                CompoundStmt * block = new CompoundStmt( noLabels );
    254254                build( dst, indices.begin(), indices.end(), init, back_inserter( block->get_kids() ) );
    255255                if ( block->get_kids().empty() ) {
    256256                        delete block;
    257                         return nullptr;
     257                        return NULL;
    258258                } else {
    259                         init = nullptr; // init was consumed in creating the list init
     259                        init = NULL; // init was consumed in creating the list init
    260260                        return block;
    261261                }
    262262        }
    263263
    264         Statement * ExprImpl::buildListInit( UntypedExpr *, std::list< Expression * > & ) {
    265                 return nullptr;
     264        Statement * ExprImpl::buildListInit( __attribute((unused)) UntypedExpr * dst, __attribute((unused)) std::list< Expression * > & indices ) {
     265                return NULL;
    266266        }
    267267
     
    270270        }
    271271
    272         bool tryConstruct( DeclarationWithType * dwt ) {
    273                 ObjectDecl * objDecl = dynamic_cast< ObjectDecl * >( dwt );
    274                 if ( ! objDecl ) return false;
     272        bool tryConstruct( ObjectDecl * objDecl ) {
    275273                return ! LinkageSpec::isBuiltin( objDecl->get_linkage() ) &&
    276                         (objDecl->get_init() == nullptr ||
    277                                 ( objDecl->get_init() != nullptr && objDecl->get_init()->get_maybeConstructed() ))
    278                         && ! objDecl->get_storageClasses().is_extern
    279                         && isConstructable( objDecl->type );
    280         }
    281 
    282         bool isConstructable( Type * type ) {
    283                 return ! dynamic_cast< VarArgsType * >( type ) && ! dynamic_cast< ReferenceType * >( type ) && ! dynamic_cast< FunctionType * >( type ) && ! Tuples::isTtype( type );
     274                        (objDecl->get_init() == NULL ||
     275                                ( objDecl->get_init() != NULL && objDecl->get_init()->get_maybeConstructed() ))
     276                        && ! objDecl->get_storageClasses().is_extern;
    284277        }
    285278
     
    321314                collectCtorDtorCalls( stmt, matches );
    322315                assert( matches.size() <= 1 );
    323                 return matches.size() == 1 ? matches.front() : nullptr;
     316                return matches.size() == 1 ? matches.front() : NULL;
    324317        }
    325318
     
    366359        ApplicationExpr * isIntrinsicCallExpr( Expression * expr ) {
    367360                ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr );
    368                 if ( ! appExpr ) return nullptr;
     361                if ( ! appExpr ) return NULL;
    369362                DeclarationWithType * function = getCalledFunction( appExpr->get_function() );
    370363                assertf( function, "getCalledFunction returned nullptr: %s", toString( appExpr->get_function() ).c_str() );
    371364                // check for Intrinsic only - don't want to remove all overridable ctor/dtors because autogenerated ctor/dtor
    372365                // will call all member dtors, and some members may have a user defined dtor.
    373                 return function->get_linkage() == LinkageSpec::Intrinsic ? appExpr : nullptr;
     366                return function->get_linkage() == LinkageSpec::Intrinsic ? appExpr : NULL;
    374367        }
    375368
     
    489482                        return refType->get_base();
    490483                } else {
    491                         return nullptr;
     484                        return NULL;
    492485                }
    493486        }
     
    495488        Type * isPointerType( Type * type ) {
    496489                if ( getPointerBase( type ) ) return type;
    497                 else return nullptr;
     490                else return NULL;
    498491        }
    499492
  • src/InitTweak/InitTweak.h

    r1755226 r9bae71f  
    3333        std::list< Expression * > makeInitList( Initializer * init );
    3434
    35         /// True if the resolver should try to construct dwt
    36         bool tryConstruct( DeclarationWithType * dwt );
    37 
    38         /// True if the type can have a user-defined constructor
    39         bool isConstructable( Type * t );
     35        /// True if the resolver should try to construct objDecl
     36        bool tryConstruct( ObjectDecl * objDecl );
    4037
    4138        /// True if the Initializer contains designations
  • src/ResolvExpr/Resolver.cc

    r1755226 r9bae71f  
    9393                PassVisitor<Resolver> resolver;
    9494                acceptAll( translationUnit, resolver );
    95         }
    96 
    97         void resolveDecl( Declaration * decl, const SymTab::Indexer &indexer ) {
    98                 PassVisitor<Resolver> resolver( indexer );
    99                 maybeAccept( decl, resolver );
    10095        }
    10196
  • src/ResolvExpr/Resolver.h

    r1755226 r9bae71f  
    2929        /// Checks types and binds syntactic constructs to typed representations
    3030        void resolve( std::list< Declaration * > translationUnit );
    31         void resolveDecl( Declaration *, const SymTab::Indexer &indexer );
    3231        Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer );
    3332        Expression *findVoidExpression( Expression *untyped, const SymTab::Indexer &indexer );
  • src/ResolvExpr/TypeEnvironment.cc

    r1755226 r9bae71f  
    123123                for ( std::list< EqvClass >::const_iterator theClass = env.begin(); theClass != env.end(); ++theClass ) {
    124124                        for ( std::set< std::string >::const_iterator theVar = theClass->vars.begin(); theVar != theClass->vars.end(); ++theVar ) {
    125 ///       std::cerr << "adding " << *theVar;
     125///       std::cout << "adding " << *theVar;
    126126                                if ( theClass->type ) {
    127 ///         std::cerr << " bound to ";
    128 ///         theClass->type->print( std::cerr );
    129 ///         std::cerr << std::endl;
     127///         std::cout << " bound to ";
     128///         theClass->type->print( std::cout );
     129///         std::cout << std::endl;
    130130                                        sub.add( *theVar, theClass->type );
    131131                                } else if ( theVar != theClass->vars.begin() ) {
    132132                                        TypeInstType *newTypeInst = new TypeInstType( Type::Qualifiers(), *theClass->vars.begin(), theClass->data.kind == TypeDecl::Ftype );
    133 ///         std::cerr << " bound to variable " << *theClass->vars.begin() << std::endl;
     133///         std::cout << " bound to variable " << *theClass->vars.begin() << std::endl;
    134134                                        sub.add( *theVar, newTypeInst );
    135135                                        delete newTypeInst;
  • src/SymTab/Autogen.cc

    r1755226 r9bae71f  
    1616#include "Autogen.h"
    1717
     18#include <cstddef>                 // for NULL
    1819#include <algorithm>               // for count_if
    1920#include <cassert>                 // for strict_dynamic_cast, assert, assertf
     
    2627#include "AddVisit.h"              // for addVisit
    2728#include "CodeGen/OperatorTable.h" // for isCtorDtor, isCtorDtorAssign
    28 #include "Common/PassVisitor.h"    // for PassVisitor
    2929#include "Common/ScopedMap.h"      // for ScopedMap<>::const_iterator, Scope...
    3030#include "Common/utility.h"        // for cloneAll, operator+
    3131#include "GenPoly/DeclMutator.h"   // for DeclMutator
    3232#include "GenPoly/ScopedSet.h"     // for ScopedSet, ScopedSet<>::iterator
    33 #include "InitTweak/GenInit.h"     // for fixReturnStatements
    34 #include "ResolvExpr/Resolver.h"   // for resolveDecl
    3533#include "SymTab/Mangler.h"        // for Mangler
    3634#include "SynTree/Attribute.h"     // For Attribute
     
    5553        };
    5654
    57         struct AutogenerateRoutines final : public WithDeclsToAdd, public WithVisitorRef<AutogenerateRoutines>, public WithGuards, public WithShortCircuiting {
     55        class AutogenerateRoutines final : public Visitor {
     56            template< typename Visitor >
     57            friend void acceptAndAdd( std::list< Declaration * > &translationUnit, Visitor &visitor );
     58            template< typename Visitor >
     59            friend void addVisitStatementList( std::list< Statement* > &stmts, Visitor &visitor );
     60          public:
     61                std::list< Declaration * > &get_declsToAdd() { return declsToAdd; }
     62
     63                typedef Visitor Parent;
     64                using Parent::visit;
     65
    5866                AutogenerateRoutines();
    5967
    60                 void previsit( EnumDecl * enumDecl );
    61                 void previsit( StructDecl * structDecl );
    62                 void previsit( UnionDecl * structDecl );
    63                 void previsit( TypeDecl * typeDecl );
    64                 void previsit( TraitDecl * traitDecl );
    65                 void previsit( FunctionDecl * functionDecl );
    66 
    67                 void previsit( FunctionType * ftype );
    68                 void previsit( PointerType * ptype );
    69 
    70                 void previsit( CompoundStmt * compoundStmt );
     68                virtual void visit( EnumDecl *enumDecl );
     69                virtual void visit( StructDecl *structDecl );
     70                virtual void visit( UnionDecl *structDecl );
     71                virtual void visit( TypeDecl *typeDecl );
     72                virtual void visit( TraitDecl *ctxDecl );
     73                virtual void visit( FunctionDecl *functionDecl );
     74
     75                virtual void visit( FunctionType *ftype );
     76                virtual void visit( PointerType *ftype );
     77
     78                virtual void visit( CompoundStmt *compoundStmt );
     79                virtual void visit( SwitchStmt *switchStmt );
    7180
    7281          private:
    73                 GenPoly::ScopedSet< std::string > structsDone;
     82                template< typename StmtClass > void visitStatement( StmtClass *stmt );
     83
     84                std::list< Declaration * > declsToAdd, declsToAddAfter;
     85                std::set< std::string > structsDone;
    7486                unsigned int functionNesting = 0;     // current level of nested functions
    7587                /// Note: the following maps could be ScopedSets, but it should be easier to work
     
    100112
    101113        void autogenerateRoutines( std::list< Declaration * > &translationUnit ) {
    102                 PassVisitor<AutogenerateRoutines> generator;
    103                 acceptAll( translationUnit, generator );
     114                AutogenerateRoutines generator;
     115                acceptAndAdd( translationUnit, generator );
    104116
    105117                // needs to be done separately because AutogenerateRoutines skips types that appear as function arguments, etc.
     
    109121
    110122        bool isUnnamedBitfield( ObjectDecl * obj ) {
    111                 return obj != nullptr && obj->get_name() == "" && obj->get_bitfieldWidth() != nullptr;
     123                return obj != NULL && obj->get_name() == "" && obj->get_bitfieldWidth() != NULL;
    112124        }
    113125
     
    116128                FunctionDecl * decl = functionDecl->clone();
    117129                delete decl->get_statements();
    118                 decl->set_statements( nullptr );
     130                decl->set_statements( NULL );
    119131                declsToAdd.push_back( decl );
    120132                decl->fixUniqueId();
     
    327339                                assert( ! func->get_functionType()->get_parameters().empty() );
    328340                                ObjectDecl * dstParam = dynamic_cast<ObjectDecl*>( func->get_functionType()->get_parameters().front() );
    329                                 ObjectDecl * srcParam = nullptr;
     341                                ObjectDecl * srcParam = NULL;
    330342                                if ( func->get_functionType()->get_parameters().size() == 2 ) {
    331343                                        srcParam = dynamic_cast<ObjectDecl*>( func->get_functionType()->get_parameters().back() );
     
    334346                                assert( dstParam );
    335347
    336                                 Expression *srcselect = srcParam ? new MemberExpr( field, new VariableExpr( srcParam ) ) : nullptr;
     348                                Expression *srcselect = srcParam ? new MemberExpr( field, new VariableExpr( srcParam ) ) : NULL;
    337349                                makeStructMemberOp( dstParam, srcselect, field, func, forward );
    338350                        } // if
     
    373385                                } else {
    374386                                        // no matching parameter, initialize field with default ctor
    375                                         makeStructMemberOp( dstParam, nullptr, field, func );
     387                                        makeStructMemberOp( dstParam, NULL, field, func );
    376388                                }
    377389                        }
     
    389401        void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd, const std::vector< FuncData > & data ) {
    390402                // Builtins do not use autogeneration.
    391                 if ( LinkageSpec::isBuiltin( aggregateDecl->get_linkage() ) ) {
     403                if ( aggregateDecl->get_linkage() == LinkageSpec::BuiltinCFA ||
     404                         aggregateDecl->get_linkage() == LinkageSpec::BuiltinC ) {
    392405                        return;
    393406                }
    394407
    395408                // Make function polymorphic in same parameters as generic struct, if applicable
    396                 const std::list< TypeDecl * > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions
     409                const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions
    397410
    398411                // generate each of the functions based on the supplied FuncData objects
     
    559572                // the order here determines the order that these functions are generated.
    560573                // assignment should come last since it uses copy constructor in return.
    561                 data.emplace_back( "?{}", genDefaultType, constructable );
    562                 data.emplace_back( "?{}", genCopyType, copyable );
    563                 data.emplace_back( "^?{}", genDefaultType, destructable );
    564                 data.emplace_back( "?=?", genAssignType, assignable );
    565         }
    566 
    567         void AutogenerateRoutines::previsit( EnumDecl * enumDecl ) {
    568                 visit_children = false;
     574                data.push_back( FuncData( "?{}", genDefaultType, constructable ) );
     575                data.push_back( FuncData( "?{}", genCopyType, copyable ) );
     576                data.push_back( FuncData( "^?{}", genDefaultType, destructable ) );
     577                data.push_back( FuncData( "?=?", genAssignType, assignable ) );
     578        }
     579
     580        void AutogenerateRoutines::visit( EnumDecl *enumDecl ) {
    569581                if ( ! enumDecl->get_members().empty() ) {
    570582                        EnumInstType *enumInst = new EnumInstType( Type::Qualifiers(), enumDecl->get_name() );
     
    574586        }
    575587
    576         void AutogenerateRoutines::previsit( StructDecl * structDecl ) {
    577                 visit_children = false;
    578                 if ( structDecl->has_body() && structsDone.find( structDecl->name ) == structsDone.end() ) {
    579                         StructInstType structInst( Type::Qualifiers(), structDecl->name );
    580                         for ( TypeDecl * typeDecl : structDecl->parameters ) {
     588        void AutogenerateRoutines::visit( StructDecl *structDecl ) {
     589                if ( structDecl->has_body() && structsDone.find( structDecl->get_name() ) == structsDone.end() ) {
     590                        StructInstType structInst( Type::Qualifiers(), structDecl->get_name() );
     591                        for ( TypeDecl * typeDecl : structDecl->get_parameters() ) {
    581592                                // need to visit assertions so that they are added to the appropriate maps
    582                                 acceptAll( typeDecl->assertions, *visitor );
    583                                 structInst.parameters.push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->name, typeDecl ) ) );
     593                                acceptAll( typeDecl->get_assertions(), *this );
     594                                structInst.get_parameters().push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), typeDecl ) ) );
    584595                        }
    585596                        structInst.set_baseStruct( structDecl );
    586597                        makeStructFunctions( structDecl, &structInst, functionNesting, declsToAddAfter, data );
    587                         structsDone.insert( structDecl->name );
     598                        structsDone.insert( structDecl->get_name() );
    588599                } // if
    589600        }
    590601
    591         void AutogenerateRoutines::previsit( UnionDecl * unionDecl ) {
    592                 visit_children = false;
     602        void AutogenerateRoutines::visit( UnionDecl *unionDecl ) {
    593603                if ( ! unionDecl->get_members().empty() ) {
    594604                        UnionInstType unionInst( Type::Qualifiers(), unionDecl->get_name() );
     
    609619
    610620        // generate ctor/dtors/assign for typedecls, e.g., otype T = int *;
    611         void AutogenerateRoutines::previsit( TypeDecl * typeDecl ) {
    612                 visit_children = false;
     621        void AutogenerateRoutines::visit( TypeDecl *typeDecl ) {
    613622                if ( ! typeDecl->base ) return;
    614623
     
    655664        }
    656665
    657         void AutogenerateRoutines::previsit( FunctionType *) {
     666        void addDecls( std::list< Declaration * > &declsToAdd, std::list< Statement * > &statements, std::list< Statement * >::iterator i ) {
     667                for ( std::list< Declaration * >::iterator decl = declsToAdd.begin(); decl != declsToAdd.end(); ++decl ) {
     668                        statements.insert( i, new DeclStmt( noLabels, *decl ) );
     669                } // for
     670                declsToAdd.clear();
     671        }
     672
     673        void AutogenerateRoutines::visit( FunctionType *) {
    658674                // ensure that we don't add assignment ops for types defined as part of the function
    659                 visit_children = false;
    660         }
    661 
    662         void AutogenerateRoutines::previsit( PointerType *) {
     675        }
     676
     677        void AutogenerateRoutines::visit( PointerType *) {
    663678                // ensure that we don't add assignment ops for types defined as part of the pointer
    664                 visit_children = false;
    665         }
    666 
    667         void AutogenerateRoutines::previsit( TraitDecl * ) {
     679        }
     680
     681        void AutogenerateRoutines::visit( TraitDecl *) {
    668682                // ensure that we don't add assignment ops for types defined as part of the trait
    669                 visit_children = false;
    670         }
    671 
    672         void AutogenerateRoutines::previsit( FunctionDecl * functionDecl ) {
    673                 visit_children = false;
     683        }
     684
     685        template< typename StmtClass >
     686        inline void AutogenerateRoutines::visitStatement( StmtClass *stmt ) {
     687                std::set< std::string > oldStructs = structsDone;
     688                addVisit( stmt, *this );
     689                structsDone = oldStructs;
     690        }
     691
     692        void AutogenerateRoutines::visit( FunctionDecl *functionDecl ) {
    674693                // record the existence of this function as appropriate
    675694                insert( functionDecl, constructable, InitTweak::isDefaultConstructor );
     
    678697                insert( functionDecl, destructable, InitTweak::isDestructor );
    679698
    680                 maybeAccept( functionDecl->type, *visitor );
     699                maybeAccept( functionDecl->get_functionType(), *this );
    681700                functionNesting += 1;
    682                 maybeAccept( functionDecl->statements, *visitor );
     701                maybeAccept( functionDecl->get_statements(), *this );
    683702                functionNesting -= 1;
    684703        }
    685704
    686         void AutogenerateRoutines::previsit( CompoundStmt * ) {
    687                 GuardScope( constructable );
    688                 GuardScope( assignable );
    689                 GuardScope( copyable );
    690                 GuardScope( destructable );
    691                 GuardScope( structsDone );
     705        void AutogenerateRoutines::visit( CompoundStmt *compoundStmt ) {
     706                constructable.beginScope();
     707                assignable.beginScope();
     708                copyable.beginScope();
     709                destructable.beginScope();
     710                visitStatement( compoundStmt );
     711                constructable.endScope();
     712                assignable.endScope();
     713                copyable.endScope();
     714                destructable.endScope();
     715        }
     716
     717        void AutogenerateRoutines::visit( SwitchStmt *switchStmt ) {
     718                visitStatement( switchStmt );
    692719        }
    693720
  • src/SymTab/FixFunction.cc

    r1755226 r9bae71f  
    2727
    2828        DeclarationWithType * FixFunction::mutate(FunctionDecl *functionDecl) {
    29                 // can't delete function type because it may contain assertions, so transfer ownership to new object
    3029                ObjectDecl *pointer = new ObjectDecl( functionDecl->get_name(), functionDecl->get_storageClasses(), functionDecl->get_linkage(), 0, new PointerType( Type::Qualifiers(), functionDecl->get_type() ), 0, functionDecl->get_attributes() );
    3130                functionDecl->get_attributes().clear();
    32                 functionDecl->type = nullptr;
     31                // can't delete function type because it may contain assertions, but can't transfer ownership without a clone since set_type checks for nullptr
     32                functionDecl->set_type( functionDecl->get_type()->clone() );
    3333                delete functionDecl;
    3434                return pointer;
  • src/SymTab/Indexer.cc

    r1755226 r9bae71f  
    4040
    4141namespace SymTab {
     42        struct NewScope {
     43                NewScope( SymTab::Indexer & indexer ) : indexer( indexer ) { indexer.enterScope(); }
     44                ~NewScope() { indexer.leaveScope(); }
     45                SymTab::Indexer & indexer;
     46        };
     47
     48        template< typename TreeType, typename VisitorType >
     49        inline void acceptNewScope( TreeType *tree, VisitorType &visitor ) {
     50                visitor.enterScope();
     51                maybeAccept( tree, visitor );
     52                visitor.leaveScope();
     53        }
     54
    4255        typedef std::unordered_map< std::string, DeclarationWithType* > MangleTable;
    4356        typedef std::unordered_map< std::string, MangleTable > IdTable;
     
    185198        }
    186199
    187         Indexer::Indexer() : tables( 0 ), scope( 0 ) {}
    188 
    189         Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) {}
    190 
    191         Indexer::Indexer( Indexer &&that ) : doDebug( that.doDebug ), tables( that.tables ), scope( that.scope ) {
     200        Indexer::Indexer( bool _doDebug ) : tables( 0 ), scope( 0 ), doDebug( _doDebug ) {}
     201
     202        Indexer::Indexer( const Indexer &that ) : tables( newRef( that.tables ) ), scope( that.scope ), doDebug( that.doDebug ) {}
     203
     204        Indexer::Indexer( Indexer &&that ) : tables( that.tables ), scope( that.scope ), doDebug( that.doDebug ) {
    192205                that.tables = 0;
    193206        }
  • src/SymTab/Indexer.h

    r1755226 r9bae71f  
    2626        class Indexer {
    2727          public:
    28                 explicit Indexer();
     28                explicit Indexer( bool useDebug = false );
    2929
    3030                Indexer( const Indexer &that );
     
    7676                void addTrait( TraitDecl *decl );
    7777
    78                 bool doDebug = false; ///< Display debugging trace?
    7978          private:
    8079                struct Impl;
     
    8281                Impl *tables;         ///< Copy-on-write instance of table data structure
    8382                unsigned long scope;  ///< Scope index of this pointer
     83                bool doDebug;         ///< Display debugging trace?
    8484
    8585                /// Takes a new ref to a table (returns null if null)
  • src/SymTab/Mangler.cc

    r1755226 r9bae71f  
    3131
    3232namespace SymTab {
    33         std::string Mangler::mangleType( Type * ty ) {
     33        std::string Mangler::mangleType( Type *ty ) {
    3434                Mangler mangler( false, true );
    3535                maybeAccept( ty, mangler );
     
    4848        }
    4949
    50         void Mangler::mangleDecl( DeclarationWithType * declaration ) {
     50        void Mangler::mangleDecl( DeclarationWithType *declaration ) {
    5151                bool wasTopLevel = isTopLevel;
    5252                if ( isTopLevel ) {
     
    7979        }
    8080
    81         void Mangler::visit( ObjectDecl * declaration ) {
     81        void Mangler::visit( ObjectDecl *declaration ) {
    8282                mangleDecl( declaration );
    8383        }
    8484
    85         void Mangler::visit( FunctionDecl * declaration ) {
     85        void Mangler::visit( FunctionDecl *declaration ) {
    8686                mangleDecl( declaration );
    8787        }
    8888
    89         void Mangler::visit( VoidType * voidType ) {
     89        void Mangler::visit( VoidType *voidType ) {
    9090                printQualifiers( voidType );
    9191                mangleName << "v";
    9292        }
    9393
    94         void Mangler::visit( BasicType * basicType ) {
     94        void Mangler::visit( BasicType *basicType ) {
    9595                static const char *btLetter[] = {
    9696                        "b",    // Bool
     
    121121        }
    122122
    123         void Mangler::visit( PointerType * pointerType ) {
     123        void Mangler::visit( PointerType *pointerType ) {
    124124                printQualifiers( pointerType );
    125125                mangleName << "P";
     
    127127        }
    128128
    129         void Mangler::visit( ArrayType * arrayType ) {
     129        void Mangler::visit( ArrayType *arrayType ) {
    130130                // TODO: encode dimension
    131131                printQualifiers( arrayType );
     
    134134        }
    135135
    136         void Mangler::visit( ReferenceType * refType ) {
     136        void Mangler::visit( ReferenceType *refType ) {
    137137                printQualifiers( refType );
    138138                mangleName << "R";
     
    149149        }
    150150
    151         void Mangler::visit( FunctionType * functionType ) {
     151        void Mangler::visit( FunctionType *functionType ) {
    152152                printQualifiers( functionType );
    153153                mangleName << "F";
     
    160160        }
    161161
    162         void Mangler::mangleRef( ReferenceToType * refType, std::string prefix ) {
     162        void Mangler::mangleRef( ReferenceToType *refType, std::string prefix ) {
    163163                printQualifiers( refType );
    164164
     
    166166        }
    167167
    168         void Mangler::mangleGenericRef( ReferenceToType * refType, std::string prefix ) {
     168        void Mangler::mangleGenericRef( ReferenceToType *refType, std::string prefix ) {
    169169                printQualifiers( refType );
    170170
     
    189189        }
    190190
    191         void Mangler::visit( StructInstType * aggregateUseType ) {
     191        void Mangler::visit( StructInstType *aggregateUseType ) {
    192192                if ( typeMode ) mangleGenericRef( aggregateUseType, "s" );
    193193                else mangleRef( aggregateUseType, "s" );
    194194        }
    195195
    196         void Mangler::visit( UnionInstType * aggregateUseType ) {
     196        void Mangler::visit( UnionInstType *aggregateUseType ) {
    197197                if ( typeMode ) mangleGenericRef( aggregateUseType, "u" );
    198198                else mangleRef( aggregateUseType, "u" );
    199199        }
    200200
    201         void Mangler::visit( EnumInstType * aggregateUseType ) {
     201        void Mangler::visit( EnumInstType *aggregateUseType ) {
    202202                mangleRef( aggregateUseType, "e" );
    203203        }
    204204
    205         void Mangler::visit( TypeInstType * typeInst ) {
     205        void Mangler::visit( TypeInstType *typeInst ) {
    206206                VarMapType::iterator varNum = varNums.find( typeInst->get_name() );
    207207                if ( varNum == varNums.end() ) {
     
    231231        }
    232232
    233         void Mangler::visit( TupleType * tupleType ) {
     233        void Mangler::visit( TupleType *tupleType ) {
    234234                printQualifiers( tupleType );
    235235                mangleName << "T";
    236                 acceptAll( tupleType->types, *this );
     236                acceptAll( tupleType->get_types(), *this );
    237237                mangleName << "_";
    238238        }
    239239
    240         void Mangler::visit( VarArgsType * varArgsType ) {
     240        void Mangler::visit( VarArgsType *varArgsType ) {
    241241                printQualifiers( varArgsType );
    242242                mangleName << "VARGS";
    243243        }
    244244
    245         void Mangler::visit( ZeroType * ) {
     245        void Mangler::visit( __attribute__((unused)) ZeroType *zeroType ) {
    246246                mangleName << "Z";
    247247        }
    248248
    249         void Mangler::visit( OneType * ) {
     249        void Mangler::visit( __attribute__((unused)) OneType *oneType ) {
    250250                mangleName << "O";
    251251        }
    252252
    253         void Mangler::visit( TypeDecl * decl ) {
     253        void Mangler::visit( TypeDecl *decl ) {
    254254                static const char *typePrefix[] = { "BT", "BD", "BF" };
    255                 mangleName << typePrefix[ decl->get_kind() ] << ( decl->name.length() + 1 ) << decl->name;
     255                mangleName << typePrefix[ decl->get_kind() ] << ( decl->get_name().length() + 1 ) << decl->get_name();
    256256        }
    257257
     
    262262        }
    263263
    264         void Mangler::printQualifiers( Type * type ) {
     264        void Mangler::printQualifiers( Type *type ) {
    265265                // skip if not including qualifiers
    266266                if ( typeMode ) return;
     
    270270                        int tcount = 0, dcount = 0, fcount = 0, vcount = 0;
    271271                        mangleName << "A";
    272                         for ( Type::ForallList::iterator i = type->forall.begin(); i != type->forall.end(); ++i ) {
     272                        for ( Type::ForallList::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
    273273                                switch ( (*i)->get_kind() ) {
    274274                                  case TypeDecl::Any:
     
    287287                                        assert( false );
    288288                                } // switch
    289                                 varNums[ (*i)->name ] = std::pair< int, int >( nextVarNum++, (int)(*i)->get_kind() );
    290                                 for ( std::list< DeclarationWithType* >::iterator assert = (*i)->assertions.begin(); assert != (*i)->assertions.end(); ++assert ) {
     289                                varNums[ (*i )->get_name() ] = std::pair< int, int >( nextVarNum++, (int )(*i )->get_kind() );
     290                                for ( std::list< DeclarationWithType* >::iterator assert = (*i )->get_assertions().begin(); assert != (*i )->get_assertions().end(); ++assert ) {
    291291                                        Mangler sub_mangler( mangleOverridable, typeMode );
    292292                                        sub_mangler.nextVarNum = nextVarNum;
     
    312312//              } // if
    313313                if ( type->get_lvalue() ) {
    314                         // mangle based on whether the type is lvalue, so that the resolver can differentiate lvalues and rvalues
    315314                        mangleName << "L";
    316                 }
     315                } // if
    317316                if ( type->get_atomic() ) {
    318317                        mangleName << "A";
  • src/SymTab/Validate.cc

    r1755226 r9bae71f  
    5656#include "FixFunction.h"               // for FixFunction
    5757#include "Indexer.h"                   // for Indexer
    58 #include "InitTweak/GenInit.h"         // for fixReturnStatements
    5958#include "InitTweak/InitTweak.h"       // for isCtorDtorAssign
    6059#include "Parser/LinkageSpec.h"        // for C
     
    151150        /// Replaces array and function types in forall lists by appropriate pointer type and assigns each Object and Function declaration a unique ID.
    152151        struct ForallPointerDecay final {
    153                 void previsit( ObjectDecl * object );
    154                 void previsit( FunctionDecl * func );
     152                void previsit( ObjectDecl *object );
     153                void previsit( FunctionDecl *func );
    155154        };
    156155
     
    580579
    581580        /// Fix up assertions - flattens assertion lists, removing all trait instances
    582         void forallFixer( std::list< TypeDecl * > & forall, BaseSyntaxNode * node ) {
    583                 for ( TypeDecl * type : forall ) {
     581        void forallFixer( Type * func ) {
     582                for ( TypeDecl * type : func->get_forall() ) {
    584583                        std::list< DeclarationWithType * > asserts;
    585584                        asserts.splice( asserts.end(), type->assertions );
     
    600599                                assertion = assertion->acceptMutator( fixer );
    601600                                if ( fixer.get_isVoid() ) {
    602                                         throw SemanticError( "invalid type void in assertion of function ", node );
     601                                        throw SemanticError( "invalid type void in assertion of function ", func );
    603602                                } // if
    604603                        } // for
     
    608607
    609608        void ForallPointerDecay::previsit( ObjectDecl *object ) {
    610                 forallFixer( object->type->forall, object );
    611                 if ( PointerType *pointer = dynamic_cast< PointerType * >( object->type ) ) {
    612                         forallFixer( pointer->base->forall, object );
     609                forallFixer( object->get_type() );
     610                if ( PointerType *pointer = dynamic_cast< PointerType * >( object->get_type() ) ) {
     611                        forallFixer( pointer->get_base() );
    613612                } // if
    614613                object->fixUniqueId();
     
    616615
    617616        void ForallPointerDecay::previsit( FunctionDecl *func ) {
    618                 forallFixer( func->type->forall, func );
     617                forallFixer( func->get_type() );
    619618                func->fixUniqueId();
    620619        }
  • src/SynTree/Visitor.h

    r1755226 r9bae71f  
    2525  public:
    2626        // visit: Default implementation of all functions visits the children
    27         // of the given syntax node, but performs no other action.
     27    // of the given syntax node, but performs no other action.
    2828
    2929        virtual void visit( ObjectDecl *objectDecl );
  • src/main.cc

    r1755226 r9bae71f  
    239239                } // if
    240240
     241                // OPTPRINT( "Concurrency" )
     242                // Concurrency::applyKeywords( translationUnit );
     243
    241244                // add the assignment statement after the initialization of a type parameter
    242245                OPTPRINT( "validate" )
Note: See TracChangeset for help on using the changeset viewer.