Changeset eaa6430 for src


Ignore:
Timestamp:
Jun 12, 2018, 11:26:23 AM (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:
589a70b
Parents:
d16cf16
git-author:
Rob Schluntz <rschlunt@…> (06/12/18 11:21:45)
git-committer:
Rob Schluntz <rschlunt@…> (06/12/18 11:26:23)
Message:

Minor cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    rd16cf16 reaa6430  
    395395
    396396        void LinkReferenceToTypes::postvisit( EnumInstType *enumInst ) {
    397                 EnumDecl *st = local_indexer->lookupEnum( enumInst->get_name() );
     397                EnumDecl *st = local_indexer->lookupEnum( enumInst->name );
    398398                // it's not a semantic error if the enum is not found, just an implicit forward declaration
    399399                if ( st ) {
    400400                        //assert( ! enumInst->get_baseEnum() || enumInst->get_baseEnum()->get_members().empty() || ! st->get_members().empty() );
    401                         enumInst->set_baseEnum( st );
    402                 } // if
    403                 if ( ! st || st->get_members().empty() ) {
     401                        enumInst->baseEnum = st;
     402                } // if
     403                if ( ! st || st->members.empty() ) {
    404404                        // use of forward declaration
    405                         forwardEnums[ enumInst->get_name() ].push_back( enumInst );
     405                        forwardEnums[ enumInst->name ].push_back( enumInst );
    406406                } // if
    407407        }
     
    416416
    417417        void LinkReferenceToTypes::postvisit( StructInstType *structInst ) {
    418                 StructDecl *st = local_indexer->lookupStruct( structInst->get_name() );
     418                StructDecl *st = local_indexer->lookupStruct( structInst->name );
    419419                // it's not a semantic error if the struct is not found, just an implicit forward declaration
    420420                if ( st ) {
    421421                        //assert( ! structInst->get_baseStruct() || structInst->get_baseStruct()->get_members().empty() || ! st->get_members().empty() );
    422                         structInst->set_baseStruct( st );
    423                 } // if
    424                 if ( ! st || st->get_members().empty() ) {
     422                        structInst->baseStruct = st;
     423                } // if
     424                if ( ! st || st->members.empty() ) {
    425425                        // use of forward declaration
    426                         forwardStructs[ structInst->get_name() ].push_back( structInst );
     426                        forwardStructs[ structInst->name ].push_back( structInst );
    427427                } // if
    428428                checkGenericParameters( structInst );
     
    430430
    431431        void LinkReferenceToTypes::postvisit( UnionInstType *unionInst ) {
    432                 UnionDecl *un = local_indexer->lookupUnion( unionInst->get_name() );
     432                UnionDecl *un = local_indexer->lookupUnion( unionInst->name );
    433433                // it's not a semantic error if the union is not found, just an implicit forward declaration
    434434                if ( un ) {
    435                         unionInst->set_baseUnion( un );
    436                 } // if
    437                 if ( ! un || un->get_members().empty() ) {
     435                        unionInst->baseUnion = un;
     436                } // if
     437                if ( ! un || un->members.empty() ) {
    438438                        // use of forward declaration
    439                         forwardUnions[ unionInst->get_name() ].push_back( unionInst );
     439                        forwardUnions[ unionInst->name ].push_back( unionInst );
    440440                } // if
    441441                checkGenericParameters( unionInst );
     
    450450                        DeclarationWithType * dwt2 = dynamic_cast<DeclarationWithType *>( d2 );
    451451                        if ( dwt1 && dwt2 ) {
    452                                 if ( dwt1->get_name() == dwt2->get_name() && ResolvExpr::typesCompatible( dwt1->get_type(), dwt2->get_type(), SymTab::Indexer() ) ) {
     452                                if ( dwt1->name == dwt2->name && ResolvExpr::typesCompatible( dwt1->get_type(), dwt2->get_type(), SymTab::Indexer() ) ) {
    453453                                        // std::cerr << "=========== equal:" << std::endl;
    454454                                        // std::cerr << "d1: " << d1 << std::endl;
     
    475475        template< typename Iterator >
    476476        void expandAssertions( TraitInstType * inst, Iterator out ) {
    477                 assertf( inst->baseTrait, "Trait instance not linked to base trait: %s", toString( inst ).c_str() );
     477                assertf( inst->baseTrait, "Trait instance not linked to base trait: %s", toCString( inst ) );
    478478                std::list< DeclarationWithType * > asserts;
    479479                for ( Declaration * decl : inst->baseTrait->members ) {
     
    518518
    519519                // need to carry over the 'sized' status of each decl in the instance
    520                 for ( auto p : group_iterate( traitDecl->get_parameters(), traitInst->get_parameters() ) ) {
     520                for ( auto p : group_iterate( traitDecl->parameters, traitInst->parameters ) ) {
    521521                        TypeExpr * expr = dynamic_cast< TypeExpr * >( std::get<1>(p) );
    522522                        if ( ! expr ) {
     
    525525                        if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( expr->get_type() ) ) {
    526526                                TypeDecl * formalDecl = std::get<0>(p);
    527                                 TypeDecl * instDecl = inst->get_baseType();
     527                                TypeDecl * instDecl = inst->baseType;
    528528                                if ( formalDecl->get_sized() ) instDecl->set_sized( true );
    529529                        }
     
    534534        void LinkReferenceToTypes::postvisit( EnumDecl *enumDecl ) {
    535535                // visit enum members first so that the types of self-referencing members are updated properly
    536                 if ( ! enumDecl->get_members().empty() ) {
    537                         ForwardEnumsType::iterator fwds = forwardEnums.find( enumDecl->get_name() );
     536                if ( ! enumDecl->members.empty() ) {
     537                        ForwardEnumsType::iterator fwds = forwardEnums.find( enumDecl->name );
    538538                        if ( fwds != forwardEnums.end() ) {
    539539                                for ( std::list< EnumInstType * >::iterator inst = fwds->second.begin(); inst != fwds->second.end(); ++inst ) {
    540                                         (*inst )->set_baseEnum( enumDecl );
     540                                        (*inst)->baseEnum = enumDecl;
    541541                                } // for
    542542                                forwardEnums.erase( fwds );
     
    574574                // visit struct members first so that the types of self-referencing members are updated properly
    575575                // xxx - need to ensure that type parameters match up between forward declarations and definition (most importantly, number of type parameters and their defaults)
    576                 if ( ! structDecl->get_members().empty() ) {
    577                         ForwardStructsType::iterator fwds = forwardStructs.find( structDecl->get_name() );
     576                if ( ! structDecl->members.empty() ) {
     577                        ForwardStructsType::iterator fwds = forwardStructs.find( structDecl->name );
    578578                        if ( fwds != forwardStructs.end() ) {
    579579                                for ( std::list< StructInstType * >::iterator inst = fwds->second.begin(); inst != fwds->second.end(); ++inst ) {
    580                                         (*inst )->set_baseStruct( structDecl );
     580                                        (*inst)->baseStruct = structDecl;
    581581                                } // for
    582582                                forwardStructs.erase( fwds );
     
    586586
    587587        void LinkReferenceToTypes::postvisit( UnionDecl *unionDecl ) {
    588                 if ( ! unionDecl->get_members().empty() ) {
    589                         ForwardUnionsType::iterator fwds = forwardUnions.find( unionDecl->get_name() );
     588                if ( ! unionDecl->members.empty() ) {
     589                        ForwardUnionsType::iterator fwds = forwardUnions.find( unionDecl->name );
    590590                        if ( fwds != forwardUnions.end() ) {
    591591                                for ( std::list< UnionInstType * >::iterator inst = fwds->second.begin(); inst != fwds->second.end(); ++inst ) {
    592                                         (*inst )->set_baseUnion( unionDecl );
     592                                        (*inst)->baseUnion = unionDecl;
    593593                                } // for
    594594                                forwardUnions.erase( fwds );
     
    600600                // ensure generic parameter instances are renamed like the base type
    601601                if ( inGeneric && typeInst->baseType ) typeInst->name = typeInst->baseType->name;
    602                 if ( NamedTypeDecl *namedTypeDecl = local_indexer->lookupType( typeInst->get_name() ) ) {
     602                if ( NamedTypeDecl *namedTypeDecl = local_indexer->lookupType( typeInst->name ) ) {
    603603                        if ( TypeDecl *typeDecl = dynamic_cast< TypeDecl * >( namedTypeDecl ) ) {
    604604                                typeInst->set_isFtype( typeDecl->get_kind() == TypeDecl::Ftype );
Note: See TracChangeset for help on using the changeset viewer.