Changeset ed34540 for src


Ignore:
Timestamp:
Jun 26, 2018, 1:17:11 PM (6 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, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
88d955f
Parents:
0b3b2ae
Message:

Update Indexer handling for typedefs

Location:
src/SymTab
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Indexer.cc

    r0b3b2ae red34540  
    272272        }
    273273
     274        NamedTypeDecl *Indexer::globalLookupType( const std::string &id ) const {
     275                return lookupTypeAtScope( id, 0 );
     276        }
     277
    274278        StructDecl *Indexer::globalLookupStruct( const std::string &id ) const {
    275279                return lookupStructAtScope( id, 0 );
     
    503507
    504508        bool addedTypeConflicts( NamedTypeDecl *existing, NamedTypeDecl *added ) {
    505                 if ( existing->get_base() == 0 ) {
     509                if ( existing->base == nullptr ) {
    506510                        return false;
    507                 } else if ( added->get_base() == 0 ) {
     511                } else if ( added->base == nullptr ) {
    508512                        return true;
    509513                } else {
    510                         SemanticError( added, "redeclaration of " );
    511                 }
     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;
    512522        }
    513523
  • src/SymTab/Indexer.h

    r0b3b2ae red34540  
    7171                TraitDecl *lookupTrait( const std::string &id ) const;
    7272
     73                /// Gets the type declaration with the given ID at global scope
     74                NamedTypeDecl *globalLookupType( const std::string &id ) const;
    7375                /// Gets the struct declaration with the given ID at global scope
    7476                StructDecl *globalLookupStruct( const std::string &id ) const;
Note: See TracChangeset for help on using the changeset viewer.