[51587aa] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
[f0121d7] | 7 | // GenInit.h -- |
---|
[51587aa] | 8 | // |
---|
[843054c2] | 9 | // Author : Rodolfo G. Esteves |
---|
[51587aa] | 10 | // Created On : Mon May 18 07:44:20 2015 |
---|
[6b0b624] | 11 | // Last Modified By : Peter A. Buhr |
---|
| 12 | // Last Modified On : Sat Jul 22 09:31:19 2017 |
---|
| 13 | // Update Count : 4 |
---|
[51587aa] | 14 | // |
---|
[48e99f2] | 15 | |
---|
[6b0b624] | 16 | #pragma once |
---|
[48e99f2] | 17 | |
---|
[bfd4974] | 18 | #include <list> // for list |
---|
| 19 | #include <string> // for string |
---|
[48e99f2] | 20 | |
---|
[234b1cb] | 21 | #include "AST/Fwd.hpp" |
---|
[b8524ca] | 22 | #include "Common/CodeLocation.h" |
---|
[bfd4974] | 23 | #include "GenPoly/ScopedSet.h" // for ScopedSet |
---|
[234b1cb] | 24 | #include "SynTree/SynTree.h" // for Visitor Nodes |
---|
[48e99f2] | 25 | |
---|
| 26 | namespace InitTweak { |
---|
[a0fdbd5] | 27 | /// Adds return value temporaries and wraps Initializers in ConstructorInit nodes |
---|
| 28 | void genInit( std::list< Declaration * > & translationUnit ); |
---|
[f0121d7] | 29 | |
---|
[8b11840] | 30 | /// Converts return statements into copy constructor calls on the hidden return variable |
---|
| 31 | void fixReturnStatements( std::list< Declaration * > & translationUnit ); |
---|
| 32 | |
---|
| 33 | /// generates a single ctor/dtor statement using objDecl as the 'this' parameter and arg as the optional argument |
---|
| 34 | ImplicitCtorDtorStmt * genCtorDtor( const std::string & fname, ObjectDecl * objDecl, Expression * arg = nullptr ); |
---|
[092528b] | 35 | |
---|
[f0121d7] | 36 | /// creates an appropriate ConstructorInit node which contains a constructor, destructor, and C-initializer |
---|
| 37 | ConstructorInit * genCtorInit( ObjectDecl * objDecl ); |
---|
[b8524ca] | 38 | ast::ConstructorInit * genCtorInit( const CodeLocation & loc, const ast::ObjectDecl * objDecl ); |
---|
[bfd4974] | 39 | |
---|
| 40 | class ManagedTypes { |
---|
| 41 | public: |
---|
| 42 | bool isManaged( ObjectDecl * objDecl ) const ; // determine if object is managed |
---|
| 43 | bool isManaged( Type * type ) const; // determine if type is managed |
---|
| 44 | |
---|
| 45 | void handleDWT( DeclarationWithType * dwt ); // add type to managed if ctor/dtor |
---|
| 46 | void handleStruct( 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 | }; |
---|
[02c7d04] | 53 | } // namespace |
---|
[48e99f2] | 54 | |
---|
[51587aa] | 55 | // Local Variables: // |
---|
| 56 | // tab-width: 4 // |
---|
| 57 | // mode: c++ // |
---|
| 58 | // compile-command: "make install" // |
---|
| 59 | // End: // |
---|