Changeset 8fd52e90
- Timestamp:
- Jul 12, 2019, 1:51:32 PM (5 years ago)
- 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
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Resolver.cc
rfce4e31 r8fd52e90 562 562 // TODO: Replace *exception type with &exception type. 563 563 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" ); 565 565 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) ) ); 567 567 findSingleExpression( throwStmt->expr, exceptType, indexer ); 568 568 } -
src/SymTab/Indexer.cc
rfce4e31 r8fd52e90 122 122 } 123 123 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 { 126 125 ++* stats().lookup_calls; 127 126 if ( ! typeTable ) return nullptr; … … 131 130 } 132 131 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 { 135 133 ++* stats().lookup_calls; 136 134 if ( ! structTable ) return nullptr; … … 140 138 } 141 139 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 { 144 141 ++* stats().lookup_calls; 145 142 if ( ! enumTable ) return nullptr; … … 149 146 } 150 147 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 { 153 149 ++* stats().lookup_calls; 154 150 if ( ! unionTable ) return nullptr; … … 158 154 } 159 155 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 { 162 157 ++* stats().lookup_calls; 163 158 if ( ! traitTable ) return nullptr; -
src/SymTab/Indexer.h
rfce4e31 r8fd52e90 64 64 /// Gets the top-most type declaration with the given ID 65 65 const NamedTypeDecl * lookupType( const std::string & id ) const; 66 NamedTypeDecl * lookupMutableType( const std::string & id ) const;67 66 /// Gets the top-most struct declaration with the given ID 68 67 const StructDecl * lookupStruct( const std::string & id ) const; 69 StructDecl * lookupMutableStruct( const std::string & id ) const;70 68 /// Gets the top-most enum declaration with the given ID 71 69 const EnumDecl * lookupEnum( const std::string & id ) const; 72 EnumDecl * lookupMutableEnum( const std::string & id ) const;73 70 /// Gets the top-most union declaration with the given ID 74 71 const UnionDecl * lookupUnion( const std::string & id ) const; 75 UnionDecl * lookupMutableUnion( const std::string & id ) const;76 72 /// Gets the top-most trait declaration with the given ID 77 73 const TraitDecl * lookupTrait( const std::string & id ) const; 78 TraitDecl * lookupMutableTrait( const std::string & id ) const;79 74 80 75 /// Gets the type declaration with the given ID at global scope -
src/SymTab/Validate.cc
rfce4e31 r8fd52e90 642 642 643 643 void LinkReferenceToTypes_old::postvisit( EnumInstType * enumInst ) { 644 EnumDecl * st = local_indexer->lookupMutableEnum( enumInst->name );644 const EnumDecl * st = local_indexer->lookupEnum( enumInst->name ); 645 645 // it's not a semantic error if the enum is not found, just an implicit forward declaration 646 646 if ( st ) { 647 enumInst->baseEnum = st;647 enumInst->baseEnum = const_cast<EnumDecl *>(st); // Just linking in the node 648 648 } // if 649 649 if ( ! st || ! st->body ) { … … 662 662 663 663 void LinkReferenceToTypes_old::postvisit( StructInstType * structInst ) { 664 StructDecl * st = local_indexer->lookupMutableStruct( structInst->name );664 const StructDecl * st = local_indexer->lookupStruct( structInst->name ); 665 665 // it's not a semantic error if the struct is not found, just an implicit forward declaration 666 666 if ( st ) { 667 structInst->baseStruct = st;667 structInst->baseStruct = const_cast<StructDecl *>(st); // Just linking in the node 668 668 } // if 669 669 if ( ! st || ! st->body ) { … … 675 675 676 676 void LinkReferenceToTypes_old::postvisit( UnionInstType * unionInst ) { 677 UnionDecl * un = local_indexer->lookupMutableUnion( unionInst->name );677 const UnionDecl * un = local_indexer->lookupUnion( unionInst->name ); 678 678 // it's not a semantic error if the union is not found, just an implicit forward declaration 679 679 if ( un ) { 680 unionInst->baseUnion = un;680 unionInst->baseUnion = const_cast<UnionDecl *>(un); // Just linking in the node 681 681 } // if 682 682 if ( ! un || ! un->body ) { … … 762 762 void LinkReferenceToTypes_old::postvisit( TraitInstType * traitInst ) { 763 763 // handle other traits 764 TraitDecl * traitDecl = local_indexer->lookupMutableTrait( traitInst->name );764 const TraitDecl * traitDecl = local_indexer->lookupTrait( traitInst->name ); 765 765 if ( ! traitDecl ) { 766 766 SemanticError( traitInst->location, "use of undeclared trait " + traitInst->name ); … … 769 769 SemanticError( traitInst, "incorrect number of trait parameters: " ); 770 770 } // if 771 traitInst->baseTrait = traitDecl;771 traitInst->baseTrait = const_cast<TraitDecl *>(traitDecl); // Just linking in the node 772 772 773 773 // need to carry over the 'sized' status of each decl in the instance
Note: See TracChangeset
for help on using the changeset viewer.