Changeset 43e0949


Ignore:
Timestamp:
Feb 19, 2019, 1:19:47 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
no_list
Children:
2f42718
Parents:
99614c2
Message:

more lists converted to vectors

Location:
src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r99614c2 r43e0949  
    330330
    331331        void CodeGenerator::postvisit( Designation * designation ) {
    332                 std::list< Expression * > designators = designation->get_designators();
     332                auto & designators = designation->designators;
    333333                if ( designators.size() == 0 ) return;
    334334                for ( Expression * des : designators ) {
     
    354354                auto initBegin = init->begin();
    355355                auto initEnd = init->end();
    356                 auto desigBegin = init->get_designations().begin();
    357                 auto desigEnd = init->get_designations().end();
     356                auto desigBegin = init->designations.begin();
     357                auto desigEnd = init->designations.end();
    358358
    359359                output << "{ ";
  • src/InitTweak/InitTweak.cc

    r99614c2 r43e0949  
    4141                                // short circuit if we already know there are designations
    4242                                if ( hasDesignations ) visit_children = false;
    43                                 else if ( ! des->get_designators().empty() ) {
     43                                else if ( ! des->designators.empty() ) {
    4444                                        hasDesignations = true;
    4545                                        visit_children = false;
  • src/Parser/InitializerNode.cc

    r99614c2 r43e0949  
    8989        if ( aggregate ) {
    9090                // steal designators from children
    91                 std::list< Designation * > designlist;
     91                std::vector< Designation * > designlist;
    9292                InitializerNode * child = next_init();
    9393                for ( ; child != nullptr; child = dynamic_cast< InitializerNode * >( child->get_next() ) ) {
  • src/ResolvExpr/AlternativeFinder.cc

    r99614c2 r43e0949  
    367367                        std::string tmp;
    368368                        if ( val >= 0 && (unsigned long long)val < tupleType->size() ) {
    369                                 alternatives.push_back( Alternative{ 
     369                                alternatives.push_back( Alternative{
    370370                                        alt, new TupleIndexExpr( expr->clone(), val ), newCost } );
    371371                        } // if
     
    474474                }
    475475
    476                 // specialization cost of return types can't be accounted for directly, it disables 
     476                // specialization cost of return types can't be accounted for directly, it disables
    477477                // otherwise-identical calls, like this example based on auto-newline in the I/O lib:
    478478                //
     
    12251225                                // count one safe conversion for each value that is thrown away
    12261226                                thisCost.incSafe( discardedValues );
    1227                                 Alternative newAlt{ 
    1228                                         restructureCast( alt.expr->clone(), toType, castExpr->isGenerated ), 
     1227                                Alternative newAlt{
     1228                                        restructureCast( alt.expr->clone(), toType, castExpr->isGenerated ),
    12291229                                        alt.env, openVars, needAssertions, alt.cost, alt.cost + thisCost };
    12301230                                inferParameters( newAlt, back_inserter( candidates ) );
     
    12901290
    12911291        void AlternativeFinder::Finder::postvisit( NameExpr *nameExpr ) {
    1292                 std::list< SymTab::Indexer::IdData > declList;
     1292                std::vector< SymTab::Indexer::IdData > declList;
    12931293                indexer.lookupId( nameExpr->name, declList );
    12941294                PRINT( std::cerr << "nameExpr is " << nameExpr->name << std::endl; )
     
    13271327                if ( sizeofExpr->get_isType() ) {
    13281328                        Type * newType = sizeofExpr->get_type()->clone();
    1329                         alternatives.push_back( Alternative{ 
     1329                        alternatives.push_back( Alternative{
    13301330                                new SizeofExpr{ resolveTypeof( newType, indexer ) }, env } );
    13311331                } else {
     
    13421342                        Alternative &choice = winners.front();
    13431343                        referenceToRvalueConversion( choice.expr, choice.cost );
    1344                         alternatives.push_back( Alternative{ 
     1344                        alternatives.push_back( Alternative{
    13451345                                choice, new SizeofExpr( choice.expr->clone() ), Cost::zero } );
    13461346                } // if
     
    13501350                if ( alignofExpr->get_isType() ) {
    13511351                        Type * newType = alignofExpr->get_type()->clone();
    1352                         alternatives.push_back( Alternative{ 
     1352                        alternatives.push_back( Alternative{
    13531353                                new AlignofExpr{ resolveTypeof( newType, indexer ) }, env } );
    13541354                } else {
     
    13651365                        Alternative &choice = winners.front();
    13661366                        referenceToRvalueConversion( choice.expr, choice.cost );
    1367                         alternatives.push_back( Alternative{ 
     1367                        alternatives.push_back( Alternative{
    13681368                                choice, new AlignofExpr{ choice.expr->clone() }, Cost::zero } );
    13691369                } // if
     
    13761376                for ( std::list< Declaration* >::const_iterator i = members.begin(); i != members.end(); ++i ) {
    13771377                        if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType* >( *i ) ) {
    1378                                 alternatives.push_back( Alternative{ 
     1378                                alternatives.push_back( Alternative{
    13791379                                        new OffsetofExpr{ aggInst->clone(), dwt }, env } );
    13801380                                renameTypes( alternatives.back().expr );
     
    14201420                                Cost cost = Cost::zero;
    14211421                                Expression * newExpr = data.combine( cost );
    1422                                 alternatives.push_back( Alternative{ 
    1423                                         new AttrExpr{ newExpr, argType->clone() }, env, OpenVarSet{}, 
     1422                                alternatives.push_back( Alternative{
     1423                                        new AttrExpr{ newExpr, argType->clone() }, env, OpenVarSet{},
    14241424                                        AssertionList{}, Cost::zero, cost } );
    14251425                                for ( DeclarationWithType * retVal : function->returnVals ) {
     
    14341434                NameExpr *nameExpr = dynamic_cast< NameExpr* >( attrExpr->get_attr() );
    14351435                assert( nameExpr );
    1436                 std::list< SymTab::Indexer::IdData > attrList;
     1436                std::vector< SymTab::Indexer::IdData > attrList;
    14371437                indexer.lookupId( nameExpr->get_name(), attrList );
    14381438                if ( attrExpr->get_isType() || attrExpr->get_expr() ) {
     
    14611461                                Cost cost = Cost::zero;
    14621462                                Expression * newExpr = data.combine( cost );
    1463                                 alternatives.push_back( Alternative{ 
     1463                                alternatives.push_back( Alternative{
    14641464                                        newExpr, env, OpenVarSet{}, AssertionList{}, Cost::zero, cost } );
    14651465                                renameTypes( alternatives.back().expr );
     
    14851485                                cloneAll( second.need, need );
    14861486
    1487                                 LogicalExpr *newExpr = new LogicalExpr{ 
     1487                                LogicalExpr *newExpr = new LogicalExpr{
    14881488                                        first.expr->clone(), second.expr->clone(), logicalExpr->get_isAnd() };
    1489                                 alternatives.push_back( Alternative{ 
    1490                                         newExpr, std::move(compositeEnv), std::move(openVars), 
     1489                                alternatives.push_back( Alternative{
     1490                                        newExpr, std::move(compositeEnv), std::move(openVars),
    14911491                                        AssertionList( need.begin(), need.end() ), first.cost + second.cost } );
    14921492                        }
     
    15211521                                        cloneAll( third.need, need );
    15221522                                        AssertionSet have;
    1523                                        
     1523
    15241524                                        // unify true and false types, then infer parameters to produce new alternatives
    15251525                                        Type* commonType = nullptr;
    1526                                         if ( unify( second.expr->result, third.expr->result, compositeEnv, 
     1526                                        if ( unify( second.expr->result, third.expr->result, compositeEnv,
    15271527                                                        need, have, openVars, indexer, commonType ) ) {
    1528                                                 ConditionalExpr *newExpr = new ConditionalExpr{ 
     1528                                                ConditionalExpr *newExpr = new ConditionalExpr{
    15291529                                                        first.expr->clone(), second.expr->clone(), third.expr->clone() };
    15301530                                                newExpr->result = commonType ? commonType : second.expr->result->clone();
    15311531                                                // convert both options to the conditional result type
    15321532                                                Cost cost = first.cost + second.cost + third.cost;
    1533                                                 cost += computeExpressionConversionCost( 
     1533                                                cost += computeExpressionConversionCost(
    15341534                                                        newExpr->arg2, newExpr->result, indexer, compositeEnv );
    1535                                                 cost += computeExpressionConversionCost( 
     1535                                                cost += computeExpressionConversionCost(
    15361536                                                        newExpr->arg3, newExpr->result, indexer, compositeEnv );
    15371537                                                // output alternative
    1538                                                 Alternative newAlt{ 
    1539                                                         newExpr, std::move(compositeEnv), std::move(openVars), 
     1538                                                Alternative newAlt{
     1539                                                        newExpr, std::move(compositeEnv), std::move(openVars),
    15401540                                                        AssertionList( need.begin(), need.end() ), cost };
    15411541                                                inferParameters( newAlt, back_inserter( alternatives ) );
     
    15521552                secondFinder.findWithAdjustment( commaExpr->get_arg2() );
    15531553                for ( const Alternative & alt : secondFinder.alternatives ) {
    1554                         alternatives.push_back( Alternative{ 
     1554                        alternatives.push_back( Alternative{
    15551555                                alt, new CommaExpr{ newFirstArg->clone(), alt.expr->clone() }, alt.cost } );
    15561556                } // for
     
    15781578
    15791579                                Type* commonType = nullptr;
    1580                                 if ( unify( first.expr->result, second.expr->result, compositeEnv, need, have, 
     1580                                if ( unify( first.expr->result, second.expr->result, compositeEnv, need, have,
    15811581                                                openVars, indexer, commonType ) ) {
    1582                                         RangeExpr * newExpr = 
     1582                                        RangeExpr * newExpr =
    15831583                                                new RangeExpr{ first.expr->clone(), second.expr->clone() };
    15841584                                        newExpr->result = commonType ? commonType : first.expr->result->clone();
    1585                                         Alternative newAlt{ 
    1586                                                 newExpr, std::move(compositeEnv), std::move(openVars), 
     1585                                        Alternative newAlt{
     1586                                                newExpr, std::move(compositeEnv), std::move(openVars),
    15871587                                                AssertionList( need.begin(), need.end() ), first.cost + second.cost };
    15881588                                        inferParameters( newAlt, back_inserter( alternatives ) );
     
    16111611                                cloneAll( alt.need, need );
    16121612                        }
    1613                        
    1614                         alternatives.push_back( Alternative{ 
    1615                                 new TupleExpr{ exprs }, std::move(compositeEnv), std::move(openVars), 
     1613
     1614                        alternatives.push_back( Alternative{
     1615                                new TupleExpr{ exprs }, std::move(compositeEnv), std::move(openVars),
    16161616                                AssertionList( need.begin(), need.end() ), sumCost( alts ) } );
    16171617                } // for
     
    16321632                finder.findWithoutPrune( ctorExpr->get_callExpr() );
    16331633                for ( Alternative & alt : finder.alternatives ) {
    1634                         alternatives.push_back( Alternative{ 
     1634                        alternatives.push_back( Alternative{
    16351635                                alt, new ConstructorExpr( alt.expr->clone() ), alt.cost } );
    16361636                }
     
    16841684                                cloneAll( alt.need, need );
    16851685                                AssertionSet have;
    1686                                 OpenVarSet openVars( alt.openVars ); 
    1687                                 // xxx - find things in env that don't have a "representative type" and claim 
     1686                                OpenVarSet openVars( alt.openVars );
     1687                                // xxx - find things in env that don't have a "representative type" and claim
    16881688                                // those are open vars?
    16891689                                PRINT(
    16901690                                        std::cerr << "  @ " << toType << " " << initAlt.designation << std::endl;
    16911691                                )
    1692                                 // It's possible that a cast can throw away some values in a multiply-valued 
    1693                                 // expression. (An example is a cast-to-void, which casts from one value to 
    1694                                 // zero.)  Figure out the prefix of the subexpression results that are cast 
    1695                                 // directly.  The candidate is invalid if it has fewer results than there are 
     1692                                // It's possible that a cast can throw away some values in a multiply-valued
     1693                                // expression. (An example is a cast-to-void, which casts from one value to
     1694                                // zero.)  Figure out the prefix of the subexpression results that are cast
     1695                                // directly.  The candidate is invalid if it has fewer results than there are
    16961696                                // types to cast to.
    16971697                                int discardedValues = alt.expr->result->size() - toType->size();
    16981698                                if ( discardedValues < 0 ) continue;
    1699                                 // xxx - may need to go into tuple types and extract relevant types and use 
    1700                                 // unifyList. Note that currently, this does not allow casting a tuple to an 
     1699                                // xxx - may need to go into tuple types and extract relevant types and use
     1700                                // unifyList. Note that currently, this does not allow casting a tuple to an
    17011701                                // atomic type (e.g. (int)([1, 2, 3]))
    1702                                
     1702
    17031703                                // unification run for side-effects
    17041704                                unify( toType, alt.expr->result, newEnv, need, have, openVars, indexer );
     
    17091709                                        // count one safe conversion for each value that is thrown away
    17101710                                        thisCost.incSafe( discardedValues );
    1711                                         Alternative newAlt{ 
    1712                                                 new InitExpr{ 
    1713                                                         restructureCast( alt.expr->clone(), toType, true ), initAlt.designation->clone() }, 
    1714                                                 std::move(newEnv), std::move(openVars), 
     1711                                        Alternative newAlt{
     1712                                                new InitExpr{
     1713                                                        restructureCast( alt.expr->clone(), toType, true ), initAlt.designation->clone() },
     1714                                                std::move(newEnv), std::move(openVars),
    17151715                                                AssertionList( need.begin(), need.end() ), alt.cost, thisCost };
    17161716                                        inferParameters( newAlt, back_inserter( candidates ) );
  • src/ResolvExpr/CurrentObject.cc

    r99614c2 r43e0949  
    228228                                std::vector<InitAlternative> ret = memberIter->first();
    229229                                for ( InitAlternative & alt : ret ) {
    230                                         alt.designation->get_designators().push_front( new ConstantExpr( Constant::from_ulong( index ) ) );
     230                                        alt.designation->designators.push_front( new ConstantExpr( Constant::from_ulong( index ) ) );
    231231                                }
    232232                                return ret;
     
    294294                                for ( InitAlternative & alt : ret ) {
    295295                                        PRINT( std::cerr << "iterating and adding designators" << std::endl; )
    296                                         alt.designation->get_designators().push_front( new VariableExpr( strict_dynamic_cast< ObjectDecl * >( *curMember ) ) );
     296                                        alt.designation->designators.push_front( new VariableExpr( strict_dynamic_cast< ObjectDecl * >( *curMember ) ) );
    297297                                        // need to substitute for generic types, so that casts are to concrete types
    298298                                        PRINT( std::cerr << "  type is: " << alt.type; )
     
    354354                                for ( InitAlternative & alt : ret ) {
    355355                                        PRINT( std::cerr << "iterating and adding designators" << std::endl; )
    356                                         alt.designation->get_designators().push_front( new VariableExpr( strict_dynamic_cast< ObjectDecl * >( *curMember ) ) );
     356                                        alt.designation->designators.push_front( new VariableExpr( strict_dynamic_cast< ObjectDecl * >( *curMember ) ) );
    357357                                }
    358358                        }
     
    465465                assertf( ! objStack.empty(), "obj stack empty in setNext" );
    466466                PRINT( std::cerr << "____setNext" << designation << std::endl; )
    467                 objStack.top()->setPosition( designation->get_designators() );
     467                objStack.top()->setPosition( designation->designators );
    468468        }
    469469
     
    472472                PRINT( std::cerr << "___findNext" << std::endl; )
    473473                // find all the d's
    474                 std::list<DesignatorChain> desigAlts{ { } }, newDesigAlts;
     474                std::vector<DesignatorChain> desigAlts{ { } }, newDesigAlts;
    475475                std::list<Type *> curTypes { (objStack.top())->getType() }, newTypes;
    476                 for ( Expression * expr : designation->get_designators() ) {
     476                for ( Expression * expr : designation->designators ) {
    477477                        PRINT( std::cerr << "____untyped: " << expr << std::endl; )
    478                         std::list<DesignatorChain>::iterator dit = desigAlts.begin();
     478                        auto dit = desigAlts.begin();
    479479                        if ( NameExpr * nexpr = dynamic_cast<NameExpr *>(expr) ) {
    480480                                for ( Type * t : curTypes ) {
  • src/ResolvExpr/ResolveAssertions.cc

    r99614c2 r43e0949  
    4747                UniqueId resnSlot;              ///< Slot for any recursive assertion IDs
    4848
    49                 AssnCandidate( const SymTab::Indexer::IdData& cdata, Type* adjType, TypeEnvironment&& env, 
    50                         AssertionSet&& have, AssertionSet&& need, OpenVarSet&& openVars, UniqueId resnSlot ) 
    51                 : cdata(cdata), adjType(adjType), env(std::move(env)), have(std::move(have)), 
     49                AssnCandidate( const SymTab::Indexer::IdData& cdata, Type* adjType, TypeEnvironment&& env,
     50                        AssertionSet&& have, AssertionSet&& need, OpenVarSet&& openVars, UniqueId resnSlot )
     51                : cdata(cdata), adjType(adjType), env(std::move(env)), have(std::move(have)),
    5252                        need(std::move(need)), openVars(std::move(openVars)), resnSlot(resnSlot) {}
    5353        };
     
    8686                const AssnCache* cache;     ///< Cache storing assertion item
    8787                std::string key;            ///< Key into cache
    88                
     88
    8989                DeferItem( const AssnCache& cache, const std::string& key ) : cache(&cache), key(key) {}
    9090
     
    9999
    100100                // sortable by key
    101                 // TODO look into optimizing combination process with other sort orders (e.g. by number 
     101                // TODO look into optimizing combination process with other sort orders (e.g. by number
    102102                // of matches in candidate)
    103103                bool operator< ( const DeferItem& o ) const { return key < o.key; }
     
    108108        using DeferList = std::vector<DeferItem>;
    109109
    110         /// Combo iterator that combines candidates into an output list, merging their environments. 
     110        /// Combo iterator that combines candidates into an output list, merging their environments.
    111111        /// Rejects an appended candidate if the environments cannot be merged.
    112112        class CandidateEnvMerger {
     
    119119                /// Indexer to use for merges
    120120                const SymTab::Indexer& indexer;
    121        
     121
    122122        public:
    123123                /// The merged environment/open variables and the list of candidates
     
    127127                        std::vector<DeferRef> assns;
    128128
    129                         OutType( const TypeEnvironment& env, const OpenVarSet& openVars, 
     129                        OutType( const TypeEnvironment& env, const OpenVarSet& openVars,
    130130                                const std::vector<DeferRef>& assns )
    131131                        : env(env), openVars(openVars), assns(assns) {}
    132132                };
    133133
    134                 CandidateEnvMerger( const TypeEnvironment& env, const OpenVarSet& openVars, 
     134                CandidateEnvMerger( const TypeEnvironment& env, const OpenVarSet& openVars,
    135135                        const SymTab::Indexer& indexer )
    136136                : crnt(), envs{ env }, varSets{ openVars }, indexer(indexer) {}
     
    158158        };
    159159
    160         /// Comparator for CandidateEnvMerger outputs that sums their costs and caches the stored 
     160        /// Comparator for CandidateEnvMerger outputs that sums their costs and caches the stored
    161161        /// sums
    162162        struct CandidateCost {
     
    176176                                Cost k = Cost::zero;
    177177                                for ( const auto& assn : x.assns ) {
    178                                         k += computeConversionCost( 
    179                                                 assn.match.adjType, assn.item.deferIds[0].decl->get_type(), indexer, 
     178                                        k += computeConversionCost(
     179                                                assn.match.adjType, assn.item.deferIds[0].decl->get_type(), indexer,
    180180                                                x.env );
    181181                                }
     
    184184                        return it->second;
    185185                }
    186                
     186
    187187                /// compares elements by cost
    188188                bool operator() ( const Element& a, const Element& b ) const {
     
    214214                /// Updated resolution state with new need-list
    215215                ResnState( ResnState&& o, IterateFlag )
    216                 : alt(std::move(o.alt)), need(o.newNeed.begin(), o.newNeed.end()), newNeed(), deferred(), 
     216                : alt(std::move(o.alt)), need(o.newNeed.begin(), o.newNeed.end()), newNeed(), deferred(),
    217217                  inferred(std::move(o.inferred)), indexer(o.indexer) {}
    218218        };
    219219
    220220        /// Binds a single assertion, updating resolution state
    221         void bindAssertion( const DeclarationWithType* decl, AssertionSetValue info, Alternative& alt, 
     221        void bindAssertion( const DeclarationWithType* decl, AssertionSetValue info, Alternative& alt,
    222222                        AssnCandidate& match, InferCache& inferred ) {
    223                
     223
    224224                DeclarationWithType* candidate = match.cdata.id;
    225225                assertf( candidate->get_uniqueId(), "Assertion candidate does not have a unique ID: %s", toString( candidate ).c_str() );
     
    232232                // place newly-inferred assertion in proper place in cache
    233233                inferred[ info.resnSlot ][ decl->get_uniqueId() ] = ParamEntry{
    234                                 candidate->get_uniqueId(), match.adjType->clone(), decl->get_type()->clone(), 
     234                                candidate->get_uniqueId(), match.adjType->clone(), decl->get_type()->clone(),
    235235                                varExpr };
    236236        }
     
    260260                if ( it == cache.end() ) {
    261261                        // lookup candidates for this assertion
    262                         std::list< SymTab::Indexer::IdData > candidates;
     262                        std::vector< SymTab::Indexer::IdData > candidates;
    263263                        resn.indexer.lookupId( assn.decl->name, candidates );
    264264
     
    277277
    278278                                // keep unifying candidates
    279                                 if ( unify( assn.decl->get_type(), adjType, newEnv, newNeed, have, newOpenVars, 
     279                                if ( unify( assn.decl->get_type(), adjType, newEnv, newNeed, have, newOpenVars,
    280280                                                resn.indexer ) ) {
    281281                                        // set up binding slot for recursive assertions
     
    288288                                        }
    289289
    290                                         matches.emplace_back( cdata, adjType, std::move(newEnv), std::move(have), 
     290                                        matches.emplace_back( cdata, adjType, std::move(newEnv), std::move(have),
    291291                                                std::move(newNeed), std::move(newOpenVars), crntResnSlot );
    292292                                } else {
     
    339339                                }
    340340                                InferredParams& inferParams = it->second;
    341                                
     341
    342342                                // place inferred parameters into proper place in expression
    343343                                for ( auto& entry : inferParams ) {
     
    402402                                        // resolve deferred assertions by mutual compatibility
    403403                                        std::vector<CandidateEnvMerger::OutType> compatible = filterCombos(
    404                                                 resn.deferred, 
     404                                                resn.deferred,
    405405                                                CandidateEnvMerger{ resn.alt.env, resn.alt.openVars, resn.indexer } );
    406406                                        // sort by cost
     
    431431                                                        // for each deferred assertion with the same form
    432432                                                        for ( AssnId id : r.item.deferIds ) {
    433                                                                 bindAssertion( 
     433                                                                bindAssertion(
    434434                                                                        id.decl, id.info, new_resn.alt, match, new_resn.inferred );
    435435                                                        }
     
    455455                        new_resns.clear();
    456456                }
    457                
     457
    458458                // exceeded recursion limit if reaches here
    459459                if ( out.empty() ) {
  • src/ResolvExpr/Resolver.cc

    r99614c2 r43e0949  
    839839                // xxx - fix this so that the list isn't copied, iterator should be used to change current
    840840                // element
    841                 std::list<Designation *> newDesignations;
    842                 for ( auto p : group_iterate(listInit->get_designations(), listInit->get_initializers()) ) {
     841                std::vector<Designation *> newDesignations;
     842                for ( auto p : group_iterate(listInit->designations, listInit->initializers) ) {
    843843                        // iterate designations and initializers in pairs, moving the cursor to the current
    844844                        // designated object and resolving the initializer against that object.
     
    849849                }
    850850                // set the set of 'resolved' designations and leave the brace-enclosed initializer-list
    851                 listInit->get_designations() = newDesignations; // xxx - memory management
     851                listInit->designations = newDesignations; // xxx - memory management
    852852                currentObject.exitListInit();
    853853
  • src/SymTab/Indexer.cc

    r99614c2 r43e0949  
    102102        }
    103103
    104         void Indexer::removeSpecialOverrides( const std::string &id, std::list< IdData > & out ) const {
     104        void Indexer::removeSpecialOverrides( const std::string &id, std::vector< IdData > & out ) const {
    105105                // only need to perform this step for constructors, destructors, and assignment functions
    106106                if ( ! CodeGen::isCtorDtorAssign( id ) ) return;
     
    116116                        bool existsUserDefinedCopyFunc = false;    // user-defined copy ctor found
    117117                        BaseSyntaxNode * deleteStmt = nullptr;     // non-null if a user-defined function is found
    118                         std::list< DeclBall > decls;
     118                        std::vector< DeclBall > decls;
    119119
    120120                        // another FunctionDecl for the current type was found - determine
     
    135135                }; // ValueType
    136136
    137                 std::list< IdData > copy;
    138                 copy.splice( copy.end(), out );
     137                std::vector< IdData > copy;
     138                swap( copy, out );
    139139
    140140                // organize discovered declarations by type
     
    231231        }
    232232
    233         void Indexer::lookupId( const std::string &id, std::list< IdData > &out ) const {
     233        void Indexer::lookupId( const std::string &id, std::vector< IdData > &out ) const {
    234234                std::unordered_set< std::string > foundMangleNames;
    235235
  • src/SymTab/Indexer.h

    r99614c2 r43e0949  
    6060
    6161                /// Gets all declarations with the given ID
    62                 void lookupId( const std::string &id, std::list< IdData > &out ) const;
     62                void lookupId( const std::string &id, std::vector< IdData > &out ) const;
    6363                /// Gets the top-most type declaration with the given ID
    6464                NamedTypeDecl *lookupType( const std::string &id ) const;
     
    140140                // so that they will not be selected
    141141                // void removeSpecialOverrides( FunctionDecl *decl );
    142                 void removeSpecialOverrides( const std::string &id, std::list< IdData > & out ) const;
     142                void removeSpecialOverrides( const std::string &id, std::vector< IdData > & out ) const;
    143143
    144144                /// Ensures that tables variable is writable (i.e. allocated, uniquely owned by this Indexer, and at the current scope)
  • src/SynTree/Initializer.cc

    r99614c2 r43e0949  
    7070
    7171
    72 ListInit::ListInit( const std::vector< Initializer * > &inits, const std::list<Designation *> &des, bool maybeConstructed )
     72ListInit::ListInit( const std::vector< Initializer * > & inits, const std::vector<Designation *> & des, bool maybeConstructed )
    7373        : Initializer( maybeConstructed ), initializers( inits ), designations( des ) {
    7474                // handle the common case where a ListInit is created without designations by making a list of empty designations with the same length as the initializer
  • src/SynTree/Initializer.h

    r99614c2 r43e0949  
    3636        virtual ~Designation();
    3737
    38         std::list< Expression * > & get_designators() { return designators; }
    39 
    4038        virtual Designation * clone() const override { return new Designation( *this ); };
    4139        virtual void accept( Visitor &v ) override { v.visit( this ); }
     
    4442};
    4543
    46 const std::list<Designation *> noDesignators;
     44const std::vector<Designation *> noDesignators;
    4745
    4846// Initializer: base class for object initializers (provide default values)
     
    8785  public:
    8886        std::vector< Initializer * > initializers;  // order *is* important
    89         std::list<Designation *> designations;  // order/length is consistent with initializers
     87        std::vector<Designation *> designations;  // order/length is consistent with initializers
    9088
    9189        ListInit( const std::vector< Initializer * > &initializers,
    92                           const std::list<Designation *> &designators = {}, bool maybeConstructed = false );
     90                          const std::vector<Designation *> &designators = {}, bool maybeConstructed = false );
    9391        ListInit( const ListInit & other );
    9492        virtual ~ListInit();
    95 
    96         std::list<Designation *> & get_designations() { return designations; }
    97         std::vector< Initializer * > & get_initializers() { return initializers; }
    9893
    9994        typedef std::vector< Initializer * >::iterator iterator;
Note: See TracChangeset for help on using the changeset viewer.