- Timestamp:
- Feb 3, 2023, 3:11:51 PM (23 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 21a2a7d
- Parents:
- 2f61765
- Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/ScopedMap.h
r2f61765 re9b5043 181 181 return c; 182 182 } 183 184 bool contains( const Key & key ) const { 185 return find( key ) != cend(); 186 } 183 187 }; 184 188 -
src/GenPoly/Box.cc
r2f61765 re9b5043 488 488 for ( FunctionType const * const funType : functions ) { 489 489 std::string mangleName = mangleAdapterName( funType, scopeTyVars ); 490 if ( adapters.find( mangleName ) == adapters.end() ) {490 if ( !adapters.contains( mangleName ) ) { 491 491 std::string adapterName = makeAdapterName( mangleName ); 492 492 adapters.insert( std::pair< std::string, DeclarationWithType *>( mangleName, new ObjectDecl( adapterName, Type::StorageClasses(), LinkageSpec::C, nullptr, new PointerType( Type::Qualifiers(), makeAdapterType( funType, scopeTyVars ) ), nullptr ) ) ); … … 1487 1487 if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( ty ) ) { 1488 1488 // do not try to monomorphize generic parameters 1489 if ( scopeTyVars. find( typeInst->get_name() ) != scopeTyVars.end() && ! genericParams.count( typeInst->name ) ) {1489 if ( scopeTyVars.contains( typeInst->get_name() ) && ! genericParams.count( typeInst->name ) ) { 1490 1490 // polymorphic aggregate members should be converted into monomorphic members. 1491 1491 // Using char[size_T] here respects the expected sizing rules of an aggregate type. … … 1696 1696 1697 1697 if ( auto typeInst = dynamic_cast< TypeInstType const * >( ty ) ) { 1698 if ( scopeTyVars. find( typeInst->get_name() ) != scopeTyVars.end() ) {1698 if ( scopeTyVars.contains( typeInst->get_name() ) ) { 1699 1699 // NOTE assumes here that getting put in the scopeTyVars included having the layout variables set 1700 1700 return true; … … 1704 1704 // check if this type already has a layout generated for it 1705 1705 std::string typeName = mangleType( ty ); 1706 if ( knownLayouts. find( typeName ) != knownLayouts.end() ) return true;1706 if ( knownLayouts.contains( typeName ) ) return true; 1707 1707 1708 1708 // check if any of the type parameters have dynamic layout; if none do, this type is (or will be) monomorphized … … 1741 1741 // check if this type already has a layout generated for it 1742 1742 std::string typeName = mangleType( ty ); 1743 if ( knownLayouts. find( typeName ) != knownLayouts.end() ) return true;1743 if ( knownLayouts.contains( typeName ) ) return true; 1744 1744 1745 1745 // check if any of the type parameters have dynamic layout; if none do, this type is (or will be) monomorphized … … 1832 1832 } else { 1833 1833 std::string offsetName = offsetofName( mangleType( ty ) ); 1834 if ( knownOffsets. find( offsetName ) != knownOffsets.end() ) {1834 if ( knownOffsets.contains( offsetName ) ) { 1835 1835 // use the already-generated offsets for this type 1836 1836 ret = new NameExpr( offsetName ); -
src/GenPoly/ErasableScopedMap.h
r2f61765 re9b5043 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ScopedMap.h --7 // ErasableScopedMap.h -- 8 8 // 9 9 // Author : Aaron B. Moss … … 118 118 std::pair< iterator, bool > insert( const Key &key, const Value &value ) { return insert( std::make_pair( key, value ) ); } 119 119 120 Value& operator[] ( const Key &key ) { 121 iterator slot = find( key ); 122 if ( slot != end() ) return slot->second; 123 return insert( key, Value() ).first->second; 124 } 125 120 126 /// Marks the given element as erased from this scope inward; returns 1 for erased an element, 0 otherwise 121 127 size_type erase( const Key &key ) { … … 130 136 } 131 137 132 Value& operator[] ( const Key &key ) { 133 iterator slot = find( key ); 134 if ( slot != end() ) return slot->second; 135 return insert( key, Value() ).first->second; 138 bool contains( const Key & key ) const { 139 return find( key ) != cend(); 136 140 } 137 141 }; -
src/GenPoly/GenPoly.cc
r2f61765 re9b5043 172 172 173 173 if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( type ) ) { 174 if ( tyVars. find( typeInst->get_name() ) != tyVars.end() ) {174 if ( tyVars.contains( typeInst->get_name() ) ) { 175 175 return type; 176 176 } … … 189 189 190 190 if ( auto typeInst = dynamic_cast< const ast::TypeInstType * >( type ) ) { 191 return tyVars.find(typeInst->typeString()) != tyVars.end() ? type : nullptr;191 if ( tyVars.contains( typeInst->typeString() ) ) return type; 192 192 } else if ( auto arrayType = dynamic_cast< const ast::ArrayType * >( type ) ) { 193 193 return isPolyType( arrayType->base, env ); … … 205 205 206 206 if ( auto inst = dynamic_cast< const ast::TypeInstType * >( type ) ) { 207 if ( typeVars. find( *inst ) != typeVars.end() ) return type;207 if ( typeVars.contains( *inst ) ) return type; 208 208 } else if ( auto array = dynamic_cast< const ast::ArrayType * >( type ) ) { 209 209 return isPolyType( array->base, subst ); … … 393 393 394 394 if ( TypeInstType *typeInstType = dynamic_cast< TypeInstType * >( type ) ) { 395 if ( tyVars. find( typeInstType->get_name() ) != tyVars.end() ) {395 if ( tyVars.contains( typeInstType->get_name() ) ) { 396 396 return true; 397 397 } -
src/GenPoly/ScopedSet.h
r2f61765 re9b5043 29 29 typedef std::vector< Scope > ScopeList; 30 30 31 ScopeList scopes; ///< scoped list of sets 31 /// Scoped list of sets. 32 ScopeList scopes; 32 33 public: 33 34 typedef typename Scope::key_type key_type; … … 100 101 return std::make_pair( iterator(scopes, res.first, scopes.size()-1), res.second ); 101 102 } 103 104 bool contains( const Value & key ) const { 105 return find( key ) != cend(); 106 } 102 107 }; 103 108
Note: See TracChangeset
for help on using the changeset viewer.