Changeset c84dd61 for src/Validate
- Timestamp:
- Jun 21, 2023, 2:38:55 AM (19 months ago)
- Branches:
- master
- Children:
- 92355883
- Parents:
- 0b0a285 (diff), 2de175ce (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. - Location:
- src/Validate
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Validate/Autogen.cpp
r0b0a285 rc84dd61 321 321 void FuncGenerator::produceDecl( const ast::FunctionDecl * decl ) { 322 322 assert( nullptr != decl->stmts ); 323 assert( decl->type_params.size() == getGenericParams( type ).size() ); 323 324 324 325 definitions.push_back( decl ); … … 356 357 decl->init = nullptr; 357 358 splice( assertions, decl->assertions ); 358 oldToNew.emplace( std::make_pair( old_param, decl ));359 oldToNew.emplace( old_param, decl ); 359 360 type_params.push_back( decl ); 360 361 } … … 522 523 InitTweak::InitExpander_new srcParam( src ); 523 524 // Assign to destination. 524 ast:: Expr * dstSelect = new ast::MemberExpr(525 ast::MemberExpr * dstSelect = new ast::MemberExpr( 525 526 location, 526 527 field, … … 574 575 } 575 576 576 ast:: Expr * srcSelect = (srcParam) ? new ast::MemberExpr(577 ast::MemberExpr * srcSelect = (srcParam) ? new ast::MemberExpr( 577 578 location, field, new ast::VariableExpr( location, srcParam ) 578 579 ) : nullptr; -
src/Validate/GenericParameter.cpp
r0b0a285 rc84dd61 120 120 } 121 121 122 struct ValidateGenericParamsCore : public ast::WithCodeLocation { 122 bool isSizedPolymorphic( const ast::AggregateDecl * decl ) { 123 for ( const auto & param : decl->params ) { 124 if ( param->sized ) return true; 125 } 126 return false; 127 } 128 129 struct ValidateGenericParamsCore : 130 public ast::WithCodeLocation, public ast::WithGuards { 131 // Generic parameter filling and checks: 123 132 const ast::StructInstType * previsit( const ast::StructInstType * type ) { 124 133 assert( location ); … … 129 138 assert( location ); 130 139 return validateGeneric( *location, type ); 140 } 141 142 // Check parameter and bitfield combinations: 143 bool insideSized = false; 144 void previsit( const ast::StructDecl * decl ) { 145 if ( isSizedPolymorphic( decl ) && !insideSized ) { 146 GuardValue( insideSized ) = true; 147 } 148 } 149 150 void previsit( const ast::UnionDecl * decl ) { 151 if ( isSizedPolymorphic( decl ) && !insideSized ) { 152 GuardValue( insideSized ) = true; 153 } 154 } 155 156 void previsit( const ast::ObjectDecl * decl ) { 157 if ( insideSized && decl->bitfieldWidth ) { 158 SemanticError( decl->location, decl, 159 "Cannot have bitfields inside a sized polymorphic structure." ); 160 } 131 161 } 132 162 }; -
src/Validate/LinkReferenceToTypes.cpp
r0b0a285 rc84dd61 84 84 // Just linking in the node. 85 85 auto mut = ast::mutate( type ); 86 mut->base = const_cast<ast::EnumDecl *>( decl );86 mut->base = decl; 87 87 type = mut; 88 88 } … … 101 101 // Just linking in the node. 102 102 auto mut = ast::mutate( type ); 103 mut->base = const_cast<ast::StructDecl *>( decl );103 mut->base = decl; 104 104 type = mut; 105 105 } … … 118 118 // Just linking in the node. 119 119 auto mut = ast::mutate( type ); 120 mut->base = const_cast<ast::UnionDecl *>( decl );120 mut->base = decl; 121 121 type = mut; 122 122 } … … 141 141 142 142 // Just linking in the node. 143 mut->base = const_cast<ast::TraitDecl *>( decl );143 mut->base = decl; 144 144 145 145 // Need to carry over the 'sized' status of each decl in the instance. … … 203 203 } 204 204 205 // The following section206 207 205 ForwardEnumsType::iterator fwds = forwardEnums.find( decl->name ); 208 206 if ( fwds != forwardEnums.end() ) {
Note: See TracChangeset
for help on using the changeset viewer.