Changeset 8fd52e90


Ignore:
Timestamp:
Jul 12, 2019, 1:51:32 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
6f096d2, c6dc7f2
Parents:
fce4e31
Message:

Removed uses of lookupMutableXXX

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    rfce4e31 r8fd52e90  
    562562                // TODO: Replace *exception type with &exception type.
    563563                if ( throwStmt->get_expr() ) {
    564                         StructDecl * exception_decl = indexer.lookupMutableStruct( "__cfaabi_ehm__base_exception_t" );
     564                        const StructDecl * exception_decl = indexer.lookupStruct( "__cfaabi_ehm__base_exception_t" );
    565565                        assert( exception_decl );
    566                         Type * exceptType = new PointerType( noQualifiers, new StructInstType( noQualifiers, exception_decl ) );
     566                        Type * exceptType = new PointerType( noQualifiers, new StructInstType( noQualifiers, const_cast<StructDecl *>(exception_decl) ) );
    567567                        findSingleExpression( throwStmt->expr, exceptType, indexer );
    568568                }
  • src/SymTab/Indexer.cc

    rfce4e31 r8fd52e90  
    122122        }
    123123
    124         const NamedTypeDecl * Indexer::lookupType( const std::string & id ) const { return lookupMutableType(id); }
    125         NamedTypeDecl * Indexer::lookupMutableType( const std::string & id ) const {
     124        const NamedTypeDecl * Indexer::lookupType( const std::string & id ) const {
    126125                ++* stats().lookup_calls;
    127126                if ( ! typeTable ) return nullptr;
     
    131130        }
    132131
    133         const StructDecl * Indexer::lookupStruct( const std::string & id ) const { return lookupMutableStruct(id); }
    134         StructDecl * Indexer::lookupMutableStruct( const std::string & id ) const {
     132        const StructDecl * Indexer::lookupStruct( const std::string & id ) const {
    135133                ++* stats().lookup_calls;
    136134                if ( ! structTable ) return nullptr;
     
    140138        }
    141139
    142         const EnumDecl * Indexer::lookupEnum( const std::string & id ) const { return lookupMutableEnum(id); }
    143         EnumDecl * Indexer::lookupMutableEnum( const std::string & id ) const {
     140        const EnumDecl * Indexer::lookupEnum( const std::string & id ) const {
    144141                ++* stats().lookup_calls;
    145142                if ( ! enumTable ) return nullptr;
     
    149146        }
    150147
    151         const UnionDecl * Indexer::lookupUnion( const std::string & id ) const { return lookupMutableUnion(id); }
    152         UnionDecl * Indexer::lookupMutableUnion( const std::string & id ) const {
     148        const UnionDecl * Indexer::lookupUnion( const std::string & id ) const {
    153149                ++* stats().lookup_calls;
    154150                if ( ! unionTable ) return nullptr;
     
    158154        }
    159155
    160         const TraitDecl * Indexer::lookupTrait( const std::string & id ) const { return lookupMutableTrait(id); }
    161         TraitDecl * Indexer::lookupMutableTrait( const std::string & id ) const {
     156        const TraitDecl * Indexer::lookupTrait( const std::string & id ) const {
    162157                ++* stats().lookup_calls;
    163158                if ( ! traitTable ) return nullptr;
  • src/SymTab/Indexer.h

    rfce4e31 r8fd52e90  
    6464                /// Gets the top-most type declaration with the given ID
    6565                const NamedTypeDecl * lookupType( const std::string & id ) const;
    66                 NamedTypeDecl * lookupMutableType( const std::string & id ) const;
    6766                /// Gets the top-most struct declaration with the given ID
    6867                const StructDecl * lookupStruct( const std::string & id ) const;
    69                 StructDecl * lookupMutableStruct( const std::string & id ) const;
    7068                /// Gets the top-most enum declaration with the given ID
    7169                const EnumDecl * lookupEnum( const std::string & id ) const;
    72                 EnumDecl * lookupMutableEnum( const std::string & id ) const;
    7370                /// Gets the top-most union declaration with the given ID
    7471                const UnionDecl * lookupUnion( const std::string & id ) const;
    75                 UnionDecl * lookupMutableUnion( const std::string & id ) const;
    7672                /// Gets the top-most trait declaration with the given ID
    7773                const TraitDecl * lookupTrait( const std::string & id ) const;
    78                 TraitDecl * lookupMutableTrait( const std::string & id ) const;
    7974
    8075                /// Gets the type declaration with the given ID at global scope
  • src/SymTab/Validate.cc

    rfce4e31 r8fd52e90  
    642642
    643643        void LinkReferenceToTypes_old::postvisit( EnumInstType * enumInst ) {
    644                 EnumDecl * st = local_indexer->lookupMutableEnum( enumInst->name );
     644                const EnumDecl * st = local_indexer->lookupEnum( enumInst->name );
    645645                // it's not a semantic error if the enum is not found, just an implicit forward declaration
    646646                if ( st ) {
    647                         enumInst->baseEnum = st;
     647                        enumInst->baseEnum = const_cast<EnumDecl *>(st); // Just linking in the node
    648648                } // if
    649649                if ( ! st || ! st->body ) {
     
    662662
    663663        void LinkReferenceToTypes_old::postvisit( StructInstType * structInst ) {
    664                 StructDecl * st = local_indexer->lookupMutableStruct( structInst->name );
     664                const StructDecl * st = local_indexer->lookupStruct( structInst->name );
    665665                // it's not a semantic error if the struct is not found, just an implicit forward declaration
    666666                if ( st ) {
    667                         structInst->baseStruct = st;
     667                        structInst->baseStruct = const_cast<StructDecl *>(st); // Just linking in the node
    668668                } // if
    669669                if ( ! st || ! st->body ) {
     
    675675
    676676        void LinkReferenceToTypes_old::postvisit( UnionInstType * unionInst ) {
    677                 UnionDecl * un = local_indexer->lookupMutableUnion( unionInst->name );
     677                const UnionDecl * un = local_indexer->lookupUnion( unionInst->name );
    678678                // it's not a semantic error if the union is not found, just an implicit forward declaration
    679679                if ( un ) {
    680                         unionInst->baseUnion = un;
     680                        unionInst->baseUnion = const_cast<UnionDecl *>(un); // Just linking in the node
    681681                } // if
    682682                if ( ! un || ! un->body ) {
     
    762762        void LinkReferenceToTypes_old::postvisit( TraitInstType * traitInst ) {
    763763                // handle other traits
    764                 TraitDecl * traitDecl = local_indexer->lookupMutableTrait( traitInst->name );
     764                const TraitDecl * traitDecl = local_indexer->lookupTrait( traitInst->name );
    765765                if ( ! traitDecl ) {
    766766                        SemanticError( traitInst->location, "use of undeclared trait " + traitInst->name );
     
    769769                        SemanticError( traitInst, "incorrect number of trait parameters: " );
    770770                } // if
    771                 traitInst->baseTrait = traitDecl;
     771                traitInst->baseTrait = const_cast<TraitDecl *>(traitDecl); // Just linking in the node
    772772
    773773                // need to carry over the 'sized' status of each decl in the instance
Note: See TracChangeset for help on using the changeset viewer.