Changeset 14c0f7b for src/Validate
- Timestamp:
- Jul 31, 2023, 11:25:51 AM (10 months ago)
- Branches:
- master
- Children:
- f496046
- Parents:
- e0332dd
- Location:
- src/Validate
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Validate/Autogen.cpp
re0332dd r14c0f7b 532 532 ) 533 533 ); 534 returngenImplicitCall(534 auto stmt = genImplicitCall( 535 535 srcParam, dstSelect, location, func->name, 536 536 field, direction 537 537 ); 538 // This could return the above directly, except the generated code is 539 // built using the structure's members and that means all the scoped 540 // names (the forall parameters) are incorrect. This corrects them. 541 if ( stmt && !decl->params.empty() ) { 542 ast::DeclReplacer::TypeMap oldToNew; 543 for ( auto pair : group_iterate( decl->params, func->type_params ) ) { 544 oldToNew.emplace( std::get<0>(pair), std::get<1>(pair) ); 545 } 546 auto node = ast::DeclReplacer::replace( stmt, oldToNew ); 547 stmt = strict_dynamic_cast<const ast::Stmt *>( node ); 548 } 549 return stmt; 538 550 } 539 551 -
src/Validate/FixQualifiedTypes.cpp
re0332dd r14c0f7b 89 89 } 90 90 91 ast::Expr const * postvisit( ast::QualifiedNameExpr const * t ) {91 ast::Expr const * postvisit( ast::QualifiedNameExpr const * t ) { 92 92 assert( location ); 93 if ( t->type_decl ) { 94 auto enumName = t->type_decl->name; 95 const ast::EnumDecl * enumDecl = symtab.lookupEnum( enumName ); 96 for ( ast::ptr<ast::Decl> const & member : enumDecl->members ) { 97 if ( auto memberAsObj = member.as<ast::ObjectDecl>() ) { 98 if ( memberAsObj->name == t->name ) { 99 return new ast::VariableExpr( t->location, memberAsObj ); 100 } 101 } else { 102 assertf( false, "unhandled qualified child type"); 93 if ( !t->type_decl ) return t; 94 95 auto enumName = t->type_decl->name; 96 const ast::EnumDecl * enumDecl = symtab.lookupEnum( enumName ); 97 for ( ast::ptr<ast::Decl> const & member : enumDecl->members ) { 98 if ( auto memberAsObj = member.as<ast::ObjectDecl>() ) { 99 if ( memberAsObj->name == t->name ) { 100 return new ast::VariableExpr( t->location, memberAsObj ); 103 101 } 102 } else { 103 assertf( false, "unhandled qualified child type" ); 104 104 } 105 } 105 106 106 auto var = new ast::ObjectDecl( t->location, t->name, 107 new ast::EnumInstType(enumDecl, ast::CV::Const), nullptr, {}, ast::Linkage::Cforall ); 108 var->mangleName = Mangle::mangle( var ); 109 return new ast::VariableExpr( t->location, var ); 110 } 111 112 return t; 107 auto var = new ast::ObjectDecl( t->location, t->name, 108 new ast::EnumInstType( enumDecl, ast::CV::Const ), 109 nullptr, {}, ast::Linkage::Cforall ); 110 var->mangleName = Mangle::mangle( var ); 111 return new ast::VariableExpr( t->location, var ); 113 112 } 114 113 -
src/Validate/ForallPointerDecay.cpp
re0332dd r14c0f7b 214 214 if ( dynamic_cast< const ast::FunctionType * >( type ) ) return; 215 215 SemanticError( obj->location, 216 toCString( "operator ", obj->name.c_str(), " is not "217 " a function or function pointer." ) );216 toCString( "operator ", obj->name.c_str(), 217 " is not a function or function pointer." ) ); 218 218 } 219 219 }; … … 237 237 ast::Pass<AssertionFunctionFixer>::run( transUnit ); 238 238 ast::Pass<OperatorChecker>::run( transUnit ); 239 } 240 241 void fixUniqueIds( ast::TranslationUnit & transUnit ) { 239 242 ast::Pass<UniqueFixCore>::run( transUnit ); 240 243 } -
src/Validate/ForallPointerDecay.hpp
re0332dd r14c0f7b 27 27 28 28 /// Cleans up assertion lists and expands traits. 29 /// Also checks that operator names are used properly on functions and 30 /// assigns unique IDs. This is a "legacy" pass. 29 /// Also checks that operator names are used properly on functions. 30 /// This is a "legacy" pass. 31 /// Must happen before auto-gen routines are added. 32 void decayForallPointers( ast::TranslationUnit & transUnit ); 33 34 /// Sets uniqueIds on any declarations that do not have one set. 31 35 /// Must be after implement concurrent keywords; because uniqueIds must be 32 36 /// set on declaration before resolution. 33 /// Must happen before auto-gen routines are added. 34 void decayForallPointers( ast::TranslationUnit & transUnit ); 37 void fixUniqueIds( ast::TranslationUnit & transUnit ); 35 38 36 39 /// Expand all traits in an assertion list.
Note: See TracChangeset
for help on using the changeset viewer.