Ignore:
Timestamp:
Jul 11, 2018, 11:55:59 AM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
0fc52b6
Parents:
fc20514 (diff), 7de22b28 (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:

fix conflicts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Indexer.cc

    rfc20514 r777ed2b  
    272272        }
    273273
     274        NamedTypeDecl *Indexer::globalLookupType( const std::string &id ) const {
     275                return lookupTypeAtScope( id, 0 );
     276        }
     277
     278        StructDecl *Indexer::globalLookupStruct( const std::string &id ) const {
     279                return lookupStructAtScope( id, 0 );
     280        }
     281
     282        UnionDecl *Indexer::globalLookupUnion( const std::string &id ) const {
     283                return lookupUnionAtScope( id, 0 );
     284        }
     285
     286        EnumDecl *Indexer::globalLookupEnum( const std::string &id ) const {
     287                return lookupEnumAtScope( id, 0 );
     288        }
     289
    274290        EnumDecl *Indexer::lookupEnum( const std::string &id ) const {
    275291                if ( ! tables ) return 0;
     
    347363                if ( ! tables ) return 0;
    348364                if ( tables->scope < scope ) return 0;
     365                if ( tables->scope > scope ) return tables->base.lookupTypeAtScope( id, scope );
    349366
    350367                TypeTable::const_iterator ret = tables->typeTable.find( id );
     
    355372                if ( ! tables ) return 0;
    356373                if ( tables->scope < scope ) return 0;
     374                if ( tables->scope > scope ) return tables->base.lookupStructAtScope( id, scope );
    357375
    358376                StructTable::const_iterator ret = tables->structTable.find( id );
     
    363381                if ( ! tables ) return 0;
    364382                if ( tables->scope < scope ) return 0;
     383                if ( tables->scope > scope ) return tables->base.lookupEnumAtScope( id, scope );
    365384
    366385                EnumTable::const_iterator ret = tables->enumTable.find( id );
     
    371390                if ( ! tables ) return 0;
    372391                if ( tables->scope < scope ) return 0;
     392                if ( tables->scope > scope ) return tables->base.lookupUnionAtScope( id, scope );
    373393
    374394                UnionTable::const_iterator ret = tables->unionTable.find( id );
     
    379399                if ( ! tables ) return 0;
    380400                if ( tables->scope < scope ) return 0;
     401                if ( tables->scope > scope ) return tables->base.lookupTraitAtScope( id, scope );
    381402
    382403                TraitTable::const_iterator ret = tables->traitTable.find( id );
     
    486507
    487508        bool addedTypeConflicts( NamedTypeDecl *existing, NamedTypeDecl *added ) {
    488                 if ( existing->get_base() == 0 ) {
     509                if ( existing->base == nullptr ) {
    489510                        return false;
    490                 } else if ( added->get_base() == 0 ) {
     511                } else if ( added->base == nullptr ) {
    491512                        return true;
    492513                } else {
    493                         SemanticError( added, "redeclaration of " );
    494                 }
     514                        assert( existing->base && added->base );
     515                        // typedef redeclarations are errors only if types are different
     516                        if ( ! ResolvExpr::typesCompatible( existing->base, added->base, Indexer() ) ) {
     517                                SemanticError( added->location, "redeclaration of " + added->name );
     518                        }
     519                }
     520                // does not need to be added to the table if both existing and added have a base that are the same
     521                return true;
    495522        }
    496523
     
    499526                makeWritable();
    500527
    501                 const std::string &id = decl->get_name();
     528                const std::string &id = decl->name;
    502529                TypeTable::iterator existing = tables->typeTable.find( id );
    503530                if ( existing == tables->typeTable.end() ) {
     
    532559                makeWritable();
    533560
    534                 const std::string &id = decl->get_name();
     561                const std::string &id = decl->name;
    535562                StructTable::iterator existing = tables->structTable.find( id );
    536563                if ( existing == tables->structTable.end() ) {
     
    551578                makeWritable();
    552579
    553                 const std::string &id = decl->get_name();
     580                const std::string &id = decl->name;
    554581                EnumTable::iterator existing = tables->enumTable.find( id );
    555582                if ( existing == tables->enumTable.end() ) {
     
    575602                makeWritable();
    576603
    577                 const std::string &id = decl->get_name();
     604                const std::string &id = decl->name;
    578605                UnionTable::iterator existing = tables->unionTable.find( id );
    579606                if ( existing == tables->unionTable.end() ) {
     
    594621                makeWritable();
    595622
    596                 const std::string &id = decl->get_name();
     623                const std::string &id = decl->name;
    597624                TraitTable::iterator existing = tables->traitTable.find( id );
    598625                if ( existing == tables->traitTable.end() ) {
Note: See TracChangeset for help on using the changeset viewer.