Changeset 522363e for src/Common


Ignore:
Timestamp:
Sep 14, 2017, 1:46:06 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
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, resolv-new, with_gc
Children:
3e3d923, bff09c8, f92c696
Parents:
c57ded70
Message:

Fix PassVisitor Indexer calls, aggregate top-level errors in PassVisitor, convert ForallPointerDecay and LinkReferenceToTypes to PassVisitor

Location:
src/Common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.impl.h

    rc57ded70 r522363e  
    6666        DeclList_t* beforeDecls = visitor.get_beforeDecls();
    6767        DeclList_t* afterDecls  = visitor.get_afterDecls();
     68        SemanticError errors;
    6869
    6970        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
     
    7374                if ( i == decls.end() ) break;
    7475
    75                 // run mutator on declaration
    76                 maybeAccept( *i, visitor );
     76                try {
     77                        // run visitor on declaration
     78                        maybeAccept( *i, visitor );
     79                } catch( SemanticError &e ) {
     80                        e.set_location( (*i)->location );
     81                        errors.append( e );
     82                }
    7783
    7884                // splice in new declarations before current decl
    7985                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
    8086        }
     87        if ( ! errors.isEmpty() ) {
     88                throw errors;
     89        }
    8190}
    8291
     
    8695        DeclList_t* beforeDecls = mutator.get_beforeDecls();
    8796        DeclList_t* afterDecls  = mutator.get_afterDecls();
     97        SemanticError errors;
    8898
    8999        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
     
    92102
    93103                if ( i == decls.end() ) break;
    94 
    95                 // run mutator on declaration
    96                 *i = maybeMutate( *i, mutator );
     104                try {
     105                        // run mutator on declaration
     106                        *i = maybeMutate( *i, mutator );
     107                } catch( SemanticError &e ) {
     108                        e.set_location( (*i)->location );
     109                        errors.append( e );
     110                }
    97111
    98112                // splice in new declarations before current decl
    99113                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
     114        }
     115        if ( ! errors.isEmpty() ) {
     116                throw errors;
    100117        }
    101118}
     
    445462        indexerAddEnum( node );
    446463
    447         // unlike structs, contexts, and unions, enums inject their members into the global scope
     464        // unlike structs, traits, and unions, enums inject their members into the global scope
    448465        maybeMutateRef( node->parameters, *this );
    449466        maybeMutateRef( node->members   , *this );
  • src/Common/PassVisitor.proto.h

    rc57ded70 r522363e  
    179179
    180180template<typename pass_type>
    181 static inline auto indexer_impl_enterScope( pass_type &, int ) {}
     181static inline auto indexer_impl_enterScope( pass_type &, long ) {}
    182182
    183183template<typename pass_type>
     
    187187
    188188template<typename pass_type>
    189 static inline auto indexer_impl_leaveScope( pass_type &, int ) {}
     189static inline auto indexer_impl_leaveScope( pass_type &, long ) {}
    190190
    191191
     
    197197                                                                                                                               \
    198198template<typename pass_type>                                                                                                   \
    199 static inline void indexer_impl_##func ( pass_type &, long, type ) {}                                                          \
     199static inline void indexer_impl_##func ( pass_type &, long, type ) { }                                                          \
    200200
    201201INDEXER_FUNC( addId     , DeclarationWithType * );
     
    215215
    216216template<typename pass_type>
    217 static inline auto indexer_impl_addStructFwd( pass_type &, int, StructDecl * ) {}
     217static inline auto indexer_impl_addStructFwd( pass_type &, long, StructDecl * ) {}
    218218
    219219template<typename pass_type>
     
    225225
    226226template<typename pass_type>
    227 static inline auto indexer_impl_addUnionFwd( pass_type &, int, UnionDecl * ) {}
     227static inline auto indexer_impl_addUnionFwd( pass_type &, long, UnionDecl * ) {}
    228228
    229229template<typename pass_type>
     
    235235
    236236template<typename pass_type>
    237 static inline auto indexer_impl_addStruct( pass_type &, int, const std::string & ) {}
     237static inline auto indexer_impl_addStruct( pass_type &, long, const std::string & ) {}
    238238
    239239template<typename pass_type>
     
    245245
    246246template<typename pass_type>
    247 static inline auto indexer_impl_addUnion( pass_type &, int, const std::string & ) {}
     247static inline auto indexer_impl_addUnion( pass_type &, long, const std::string & ) {}
Note: See TracChangeset for help on using the changeset viewer.