Changeset 2a301ff for src/GenPoly


Ignore:
Timestamp:
Aug 31, 2023, 11:31:15 PM (2 years ago)
Author:
JiadaL <j82liang@…>
Branches:
master, stuck-waitfor-destruct
Children:
950c58e
Parents:
92355883 (diff), 686912c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Resolve conflict

Location:
src/GenPoly
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    r92355883 r2a301ff  
    15381538                }
    15391539
     1540                /// Checks if memberDecl matches the decl from an aggregate.
     1541                bool isMember( DeclarationWithType *memberDecl, Declaration * decl ) {
     1542                        if ( memberDecl->get_name() != decl->get_name() )
     1543                                return false;
     1544
     1545                        if ( memberDecl->get_name().empty() ) {
     1546                                // Plan-9 Field: match on unique_id.
     1547                                return ( memberDecl->get_uniqueId() == decl->get_uniqueId() );
     1548                        }
     1549
     1550                        DeclarationWithType *declWithType = strict_dynamic_cast< DeclarationWithType* >( decl );
     1551
     1552                        if ( memberDecl->get_mangleName().empty() || declWithType->get_mangleName().empty() ) {
     1553                                // Tuple-Element Field: expect neither had mangled name; accept match on simple name (like field_2) only.
     1554                                assert( memberDecl->get_mangleName().empty() && declWithType->get_mangleName().empty() );
     1555                                return true;
     1556                        }
     1557
     1558                        // Ordinary Field: Use full name to accommodate overloading.
     1559                        return ( memberDecl->get_mangleName() == declWithType->get_mangleName() );
     1560                }
     1561
    15401562                /// Finds the member in the base list that matches the given declaration; returns its index, or -1 if not present
    15411563                long findMember( DeclarationWithType *memberDecl, std::list< Declaration* > &baseDecls ) {
    15421564                        for ( auto pair : enumerate( baseDecls ) ) {
    1543                                 Declaration * decl = pair.val;
    1544                                 size_t i = pair.idx;
    1545                                 if ( memberDecl->get_name() != decl->get_name() )
    1546                                         continue;
    1547 
    1548                                 if ( memberDecl->get_name().empty() ) {
    1549                                         // plan-9 field: match on unique_id
    1550                                         if ( memberDecl->get_uniqueId() == decl->get_uniqueId() )
    1551                                                 return i;
    1552                                         else
    1553                                                 continue;
    1554                                 }
    1555 
    1556                                 DeclarationWithType *declWithType = strict_dynamic_cast< DeclarationWithType* >( decl );
    1557 
    1558                                 if ( memberDecl->get_mangleName().empty() || declWithType->get_mangleName().empty() ) {
    1559                                         // tuple-element field: expect neither had mangled name; accept match on simple name (like field_2) only
    1560                                         assert( memberDecl->get_mangleName().empty() && declWithType->get_mangleName().empty() );
    1561                                         return i;
    1562                                 }
    1563 
    1564                                 // ordinary field: use full name to accommodate overloading
    1565                                 if ( memberDecl->get_mangleName() == declWithType->get_mangleName() )
    1566                                         return i;
    1567                                 else
    1568                                         continue;
     1565                                if ( isMember( memberDecl, pair.val ) ) {
     1566                                        return pair.idx;
     1567                                }
    15691568                        }
    15701569                        return -1;
  • src/GenPoly/ErasableScopedMap.h

    r92355883 r2a301ff  
    5757        /// Starts a new scope
    5858        void beginScope() {
    59                 Scope scope;
    60                 scopes.push_back(scope);
     59                scopes.emplace_back();
    6160        }
    6261
     
    145144                public std::iterator< std::bidirectional_iterator_tag, value_type > {
    146145        friend class ErasableScopedMap;
    147         typedef typename std::map< Key, Value >::iterator wrapped_iterator;
    148         typedef typename std::vector< std::map< Key, Value > > scope_list;
    149         typedef typename scope_list::size_type size_type;
     146        typedef typename Scope::iterator wrapped_iterator;
     147        typedef typename ScopeList::size_type size_type;
    150148
    151149        /// Checks if this iterator points to a valid item
  • src/GenPoly/ScopedSet.h

    r92355883 r2a301ff  
    4747        /// Starts a new scope
    4848        void beginScope() {
    49                 Scope scope;
    50                 scopes.push_back(scope);
     49                scopes.emplace_back();
    5150        }
    5251
     
    8584        iterator findNext( const_iterator &it, const Value &key ) {
    8685                if ( it.i == 0 ) return end();
    87                         for ( size_type i = it.i - 1; ; --i ) {
     86                for ( size_type i = it.i - 1; ; --i ) {
    8887                        typename Scope::iterator val = scopes[i].find( key );
    8988                        if ( val != scopes[i].end() ) return iterator( scopes, val, i );
     
    112111        friend class ScopedSet;
    113112        friend class const_iterator;
    114         typedef typename std::set< Value >::iterator wrapped_iterator;
    115         typedef typename std::vector< std::set< Value > > scope_list;
    116         typedef typename scope_list::size_type size_type;
     113        typedef typename Scope::iterator wrapped_iterator;
     114        typedef typename ScopeList::size_type size_type;
    117115
    118116        /// Checks if this iterator points to a valid item
     
    133131        }
    134132
    135         iterator(scope_list const &_scopes, const wrapped_iterator &_it, size_type _i)
     133        iterator(ScopeList const &_scopes, const wrapped_iterator &_it, size_type _i)
    136134                : scopes(&_scopes), it(_it), i(_i) {}
    137135public:
     
    176174
    177175private:
    178         scope_list const *scopes;
     176        ScopeList const *scopes;
    179177        wrapped_iterator it;
    180178        size_type i;
     
    185183                public std::iterator< std::bidirectional_iterator_tag, value_type > {
    186184        friend class ScopedSet;
    187         typedef typename std::set< Value >::iterator wrapped_iterator;
    188         typedef typename std::set< Value >::const_iterator wrapped_const_iterator;
    189         typedef typename std::vector< std::set< Value > > scope_list;
    190         typedef typename scope_list::size_type size_type;
     185        typedef typename Scope::iterator wrapped_iterator;
     186        typedef typename Scope::const_iterator wrapped_const_iterator;
     187        typedef typename ScopeList::size_type size_type;
    191188
    192189        /// Checks if this iterator points to a valid item
     
    207204        }
    208205
    209         const_iterator(scope_list const &_scopes, const wrapped_const_iterator &_it, size_type _i)
     206        const_iterator(ScopeList const &_scopes, const wrapped_const_iterator &_it, size_type _i)
    210207                : scopes(&_scopes), it(_it), i(_i) {}
    211208public:
     
    255252
    256253private:
    257         scope_list const *scopes;
     254        ScopeList const *scopes;
    258255        wrapped_const_iterator it;
    259256        size_type i;
  • src/GenPoly/SpecializeNew.cpp

    r92355883 r2a301ff  
    104104
    105105bool needsPolySpecialization(
    106                 const ast::Type * formalType,
     106                const ast::Type * /*formalType*/,
    107107                const ast::Type * actualType,
    108108                const ast::TypeSubstitution * subs ) {
     
    126126                        if ( closedVars.find( *inst ) == closedVars.end() ) {
    127127                                return true;
    128                         }
    129                         else {
     128                        } else {
    130129                                assertf(false, "closed: %s", inst->name.c_str());
    131130                        }
Note: See TracChangeset for help on using the changeset viewer.