Changeset 0bd3faf for src/InitTweak/GenInit.cc
- Timestamp:
- Nov 13, 2023, 1:40:12 PM (6 months ago)
- Branches:
- master
- Children:
- 6ea85b22
- Parents:
- 25f2798
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/GenInit.cc
r25f2798 r0bd3faf 46 46 namespace { 47 47 48 # warning Remove the _New suffix after the conversion is complete.49 50 48 // Outer pass finds declarations, for their type could wrap a type that needs hoisting 51 struct HoistArrayDimension_NoResolve _Newfinal :49 struct HoistArrayDimension_NoResolve final : 52 50 public ast::WithDeclsToAdd<>, public ast::WithShortCircuiting, 53 51 public ast::WithGuards, public ast::WithConstTranslationUnit, 54 public ast::WithVisitorRef<HoistArrayDimension_NoResolve _New>,52 public ast::WithVisitorRef<HoistArrayDimension_NoResolve>, 55 53 public ast::WithSymbolTableX<ast::SymbolTable::ErrorDetection::IgnoreErrors> { 56 54 … … 59 57 public ast::WithShortCircuiting, public ast::WithGuards { 60 58 61 HoistArrayDimension_NoResolve _New* outer;62 HoistDimsFromTypes( HoistArrayDimension_NoResolve _New* outer ) : outer(outer) {}59 HoistArrayDimension_NoResolve * outer; 60 HoistDimsFromTypes( HoistArrayDimension_NoResolve * outer ) : outer(outer) {} 63 61 64 62 // Only intended for visiting through types. … … 211 209 212 210 213 struct ReturnFixer _Newfinal :211 struct ReturnFixer final : 214 212 public ast::WithStmtsToAdd<>, ast::WithGuards, ast::WithShortCircuiting { 215 213 void previsit( const ast::FunctionDecl * decl ); … … 219 217 }; 220 218 221 void ReturnFixer _New::previsit( const ast::FunctionDecl * decl ) {219 void ReturnFixer::previsit( const ast::FunctionDecl * decl ) { 222 220 if (decl->linkage == ast::Linkage::Intrinsic) visit_children = false; 223 221 GuardValue( funcDecl ) = decl; 224 222 } 225 223 226 const ast::ReturnStmt * ReturnFixer _New::previsit(224 const ast::ReturnStmt * ReturnFixer::previsit( 227 225 const ast::ReturnStmt * stmt ) { 228 226 auto & returns = funcDecl->returns; … … 265 263 266 264 void genInit( ast::TranslationUnit & transUnit ) { 267 ast::Pass<HoistArrayDimension_NoResolve _New>::run( transUnit );268 ast::Pass<ReturnFixer _New>::run( transUnit );265 ast::Pass<HoistArrayDimension_NoResolve>::run( transUnit ); 266 ast::Pass<ReturnFixer>::run( transUnit ); 269 267 } 270 268 271 269 void fixReturnStatements( ast::TranslationUnit & transUnit ) { 272 ast::Pass<ReturnFixer _New>::run( transUnit );273 } 274 275 bool ManagedTypes _new::isManaged( const ast::Type * type ) const {270 ast::Pass<ReturnFixer>::run( transUnit ); 271 } 272 273 bool ManagedTypes::isManaged( const ast::Type * type ) const { 276 274 // references are never constructed 277 275 if ( dynamic_cast< const ast::ReferenceType * >( type ) ) return false; … … 292 290 } 293 291 294 bool ManagedTypes _new::isManaged( const ast::ObjectDecl * objDecl ) const {292 bool ManagedTypes::isManaged( const ast::ObjectDecl * objDecl ) const { 295 293 const ast::Type * type = objDecl->type; 296 294 while ( auto at = dynamic_cast< const ast::ArrayType * >( type ) ) { … … 302 300 } 303 301 304 void ManagedTypes _new::handleDWT( const ast::DeclWithType * dwt ) {302 void ManagedTypes::handleDWT( const ast::DeclWithType * dwt ) { 305 303 // if this function is a user-defined constructor or destructor, mark down the type as "managed" 306 304 if ( ! dwt->linkage.is_overrideable && CodeGen::isCtorDtor( dwt->name ) ) { … … 313 311 } 314 312 315 void ManagedTypes _new::handleStruct( const ast::StructDecl * aggregateDecl ) {313 void ManagedTypes::handleStruct( const ast::StructDecl * aggregateDecl ) { 316 314 // don't construct members, but need to take note if there is a managed member, 317 315 // because that means that this type is also managed … … 329 327 } 330 328 331 void ManagedTypes _new::beginScope() { managedTypes.beginScope(); }332 void ManagedTypes _new::endScope() { managedTypes.endScope(); }329 void ManagedTypes::beginScope() { managedTypes.beginScope(); } 330 void ManagedTypes::endScope() { managedTypes.endScope(); } 333 331 334 332 ast::ptr<ast::Stmt> genCtorDtor (const CodeLocation & loc, const std::string & fname, const ast::ObjectDecl * objDecl, const ast::Expr * arg) { 335 333 assertf(objDecl, "genCtorDtor passed null objDecl"); 336 InitExpander _newsrcParam(arg);334 InitExpander srcParam(arg); 337 335 return SymTab::genImplicitCall(srcParam, new ast::VariableExpr(loc, objDecl), loc, fname, objDecl); 338 336 } … … 341 339 // call into genImplicitCall from Autogen.h to generate calls to ctor/dtor for each 342 340 // constructable object 343 InitExpander _newsrcParam{ objDecl->init }, nullParam{ (const ast::Init *)nullptr };341 InitExpander srcParam{ objDecl->init }, nullParam{ (const ast::Init *)nullptr }; 344 342 ast::ptr< ast::Expr > dstParam = new ast::VariableExpr(loc, objDecl); 345 343
Note: See TracChangeset
for help on using the changeset viewer.