Changeset 8984003 for src/InitTweak/GenInit.h
- Timestamp:
- Nov 21, 2023, 4:47:58 PM (7 months ago)
- Branches:
- master
- Children:
- 53dac82
- Parents:
- c36a419
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/GenInit.h
rc36a419 r8984003 24 24 25 25 namespace InitTweak { 26 /// Adds return value temporaries and wraps Initializers in ConstructorInit nodes27 void genInit( ast::TranslationUnit & translationUnit );28 26 29 /// Converts return statements into copy constructor calls on the hidden return variable. 30 /// This pass must happen before auto-gen. 31 void fixReturnStatements( ast::TranslationUnit & translationUnit ); 27 /// Adds return value temporaries and wraps Initializers in ConstructorInit nodes 28 void genInit( ast::TranslationUnit & translationUnit ); 32 29 33 /// generates a single ctor/dtor statement using objDecl as the 'this' parameter and arg as the optional argument 34 ast::ptr<ast::Stmt> genCtorDtor (const CodeLocation & loc, const std::string & fname, const ast::ObjectDecl * objDecl, const ast::Expr * arg = nullptr); 30 /// Converts return statements into copy constructor calls on the hidden return variable. 31 /// This pass must happen before auto-gen. 32 void fixReturnStatements( ast::TranslationUnit & translationUnit ); 35 33 36 /// creates an appropriate ConstructorInit node which contains a constructor, destructor, and C-initializer 37 ast::ConstructorInit * genCtorInit( const CodeLocation & loc, const ast::ObjectDecl * objDecl);34 /// generates a single ctor/dtor statement using objDecl as the 'this' parameter and arg as the optional argument 35 ast::ptr<ast::Stmt> genCtorDtor (const CodeLocation & loc, const std::string & fname, const ast::ObjectDecl * objDecl, const ast::Expr * arg = nullptr); 38 36 39 class ManagedTypes final { 40 public: 41 bool isManaged( const ast::ObjectDecl * objDecl ) const ; // determine if object is managed 42 bool isManaged( const ast::Type * type ) const; // determine if type is managed 37 /// creates an appropriate ConstructorInit node which contains a constructor, destructor, and C-initializer 38 ast::ConstructorInit * genCtorInit( const CodeLocation & loc, const ast::ObjectDecl * objDecl ); 43 39 44 void handleDWT( const ast::DeclWithType * dwt ); // add type to managed if ctor/dtor 45 void handleStruct( const ast::StructDecl * aggregateDecl ); // add type to managed if child is managed 40 class ManagedTypes final { 41 public: 42 bool isManaged( const ast::ObjectDecl * objDecl ) const ; // determine if object is managed 43 bool isManaged( const ast::Type * type ) const; // determine if type is managed 46 44 47 void beginScope(); 48 void endScope(); 49 private: 50 GenPoly::ScopedSet< std::string > managedTypes; 51 }; 45 void handleDWT( const ast::DeclWithType * dwt ); // add type to managed if ctor/dtor 46 void handleStruct( const ast::StructDecl * aggregateDecl ); // add type to managed if child is managed 47 48 void beginScope(); 49 void endScope(); 50 private: 51 GenPoly::ScopedSet< std::string > managedTypes; 52 }; 53 52 54 } // namespace 53 55
Note: See TracChangeset
for help on using the changeset viewer.