Changeset 8d25360


Ignore:
Timestamp:
Feb 13, 2019, 12:24:12 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
no_list
Children:
80eefcb
Parents:
bbbc067
Message:

Fixed problems with changing some lists to vectors

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Common/utility.h

    rbbbc067 r8d25360  
    9494template< typename SrcContainer, typename DestContainer >
    9595void cloneAll( const SrcContainer &src, DestContainer &dest ) {
    96         typename SrcContainer::const_iterator in = src.begin();
    97         std::back_insert_iterator< DestContainer > out( dest );
    98         while ( in != src.end() ) {
    99                 *out++ = (*in++)->clone();
    100         } // while
     96        std::transform(src.begin(), src.end(), std::back_insert_iterator< DestContainer >( dest ),
     97                [](const typename SrcContainer::value_type & t) -> typename DestContainer::value_type {
     98                        return t->clone();
     99                }
     100        );
    101101}
    102102
     
    464464
    465465// -----------------------------------------------------------------------------
    466 /// Reorders the input range in-place so that the minimal-value elements according to the 
    467 /// comparator are in front; 
     466/// Reorders the input range in-place so that the minimal-value elements according to the
     467/// comparator are in front;
    468468/// returns the iterator after the last minimal-value element.
    469469template<typename Iter, typename Compare>
    470470Iter sort_mins( Iter begin, Iter end, Compare& lt ) {
    471471        if ( begin == end ) return end;
    472        
     472
    473473        Iter min_pos = begin;
    474474        for ( Iter i = begin + 1; i != end; ++i ) {
  • src/Parser/TypeData.cc

    rbbbc067 r8d25360  
    887887
    888888
    889 NamedTypeDecl * buildSymbolic( const TypeData * td, std::vector< Attribute * > attributes, const string & name, Type::StorageClasses scs, LinkageSpec::Spec linkage ) {
     889NamedTypeDecl * buildSymbolic( const TypeData * td, const std::vector< Attribute * > & attributes, const string & name, Type::StorageClasses scs, LinkageSpec::Spec linkage ) {
    890890        assert( td->kind == TypeData::Symbolic );
    891891        NamedTypeDecl * ret;
     
    947947
    948948
    949 Declaration * buildDecl( const TypeData * td, const string &name, Type::StorageClasses scs, Expression * bitfieldWidth, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec linkage, Expression *asmName, Initializer * init, std::vector< Attribute * > attributes ) {
     949Declaration * buildDecl( const TypeData * td, const string &name, Type::StorageClasses scs, Expression * bitfieldWidth, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec linkage, Expression *asmName, Initializer * init, const std::vector< Attribute * > & attributes ) {
    950950        if ( td->kind == TypeData::Function ) {
    951951                if ( td->function.idList ) {                                    // KR function ?
  • src/Parser/TypeData.h

    rbbbc067 r8d25360  
    130130TypeofType * buildTypeof( const TypeData * );
    131131Declaration * buildDecl( const TypeData *, const std::string &, Type::StorageClasses, Expression *, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec, Expression * asmName,
    132                                                  Initializer * init = nullptr, std::vector< Attribute * > attributes = std::vector< Attribute * >() );
     132                                                 Initializer * init = nullptr, const std::vector< Attribute * > & attributes = std::vector< Attribute * >() );
    133133FunctionType * buildFunction( const TypeData * );
    134134void buildKRFunction( const TypeData::Function_t & function );
  • src/SymTab/Validate.cc

    rbbbc067 r8d25360  
    913913                        if ( ! inFunctionType ) {
    914914                                ret->attributes.insert( ret->attributes.end(), typeInst->attributes.begin(), typeInst->attributes.end() );
     915                                typeInst->attributes.clear();
    915916                        } else {
    916917                                deleteAll( ret->attributes );
Note: See TracChangeset for help on using the changeset viewer.