Ignore:
Timestamp:
Apr 17, 2018, 12:01:09 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
3265399
Parents:
b2fe1c9 (diff), 81bb114 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    rb2fe1c9 r32cab5b  
    8989                void previsit( StructDecl * aggregateDecl );
    9090                void previsit( UnionDecl * aggregateDecl );
     91                void previsit( StaticAssertDecl * assertDecl );
    9192
    9293          private:
     
    147148                void previsit( ObjectDecl * object );
    148149                void previsit( FunctionDecl * func );
     150                void previsit( FunctionType * ftype );
    149151                void previsit( StructDecl * aggrDecl );
    150152                void previsit( UnionDecl * aggrDecl );
     
    296298        }
    297299
    298         bool isStructOrUnion( Declaration *decl ) {
    299                 return dynamic_cast< StructDecl * >( decl ) || dynamic_cast< UnionDecl * >( decl );
     300        bool shouldHoist( Declaration *decl ) {
     301                return dynamic_cast< StructDecl * >( decl ) || dynamic_cast< UnionDecl * >( decl ) || dynamic_cast< StaticAssertDecl * >( decl );
    300302        }
    301303
     
    310312                } // if
    311313                // Always remove the hoisted aggregate from the inner structure.
    312                 GuardAction( [aggregateDecl]() { filter( aggregateDecl->members, isStructOrUnion, false ); } );
     314                GuardAction( [aggregateDecl]() { filter( aggregateDecl->members, shouldHoist, false ); } );
    313315        }
    314316
     
    328330                if ( inst->baseUnion ) {
    329331                        declsToAddBefore.push_front( inst->baseUnion );
     332                }
     333        }
     334
     335        void HoistStruct::previsit( StaticAssertDecl * assertDecl ) {
     336                if ( parentAggr ) {
     337                        declsToAddBefore.push_back( assertDecl );
    330338                }
    331339        }
     
    626634
    627635        void ForallPointerDecay::previsit( ObjectDecl *object ) {
    628                 forallFixer( object->type->forall, object );
    629                 if ( PointerType *pointer = dynamic_cast< PointerType * >( object->type ) ) {
    630                         forallFixer( pointer->base->forall, object );
    631                 } // if
     636                // ensure that operator names only apply to functions or function pointers
     637                if ( CodeGen::isOperator( object->name ) && ! dynamic_cast< FunctionType * >( object->type->stripDeclarator() ) ) {
     638                        SemanticError( object->location, toCString( "operator ", object->name.c_str(), " is not a function or function pointer." ) );
     639                }
    632640                object->fixUniqueId();
    633641        }
    634642
    635643        void ForallPointerDecay::previsit( FunctionDecl *func ) {
    636                 forallFixer( func->type->forall, func );
    637644                func->fixUniqueId();
     645        }
     646
     647        void ForallPointerDecay::previsit( FunctionType * ftype ) {
     648                forallFixer( ftype->forall, ftype );
    638649        }
    639650
Note: See TracChangeset for help on using the changeset viewer.