source: src/InitTweak/GenInit.hpp @ 2325b57

Last change on this file since 2325b57 was c92bdcc, checked in by Andrew Beach <ajbeach@…>, 6 months ago

Updated the rest of the names in src/ (except for the generated files).

  • Property mode set to 100644
File size: 2.1 KB
RevLine 
[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//
[c92bdcc]7// GenInit.hpp -- Generate initializers, and other stuff.
[51587aa]8//
[843054c2]9// Author           : Rodolfo G. Esteves
[51587aa]10// Created On       : Mon May 18 07:44:20 2015
[a36eb2d]11// Last Modified By : Andrew Beach
[4ec9513]12// Last Modified On : Fri Mar 18 14:22:00 2022
13// Update Count     : 7
[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"
[c92bdcc]22#include "Common/CodeLocation.hpp"
23#include "GenPoly/ScopedSet.hpp"   // for ScopedSet
[48e99f2]24
25namespace InitTweak {
[f0121d7]26
[8984003]27/// Adds return value temporaries and wraps Initializers in ConstructorInit nodes
28void genInit( ast::TranslationUnit & translationUnit );
[8b11840]29
[8984003]30/// Converts return statements into copy constructor calls on the hidden return variable.
31/// This pass must happen before auto-gen.
32void fixReturnStatements( ast::TranslationUnit & translationUnit );
[092528b]33
[8984003]34/// generates a single ctor/dtor statement using objDecl as the 'this' parameter and arg as the optional argument
[4e2f1b2]35const ast::Stmt * genCtorDtor( const CodeLocation & loc, const std::string & fname, const ast::ObjectDecl * objDecl, const ast::Expr * arg = nullptr );
[bfd4974]36
[8984003]37/// creates an appropriate ConstructorInit node which contains a constructor, destructor, and C-initializer
38ast::ConstructorInit * genCtorInit( const CodeLocation & loc, const ast::ObjectDecl * objDecl );
[16ba4a6f]39
[8984003]40class ManagedTypes final {
41public:
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
44
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();
50private:
51        GenPoly::ScopedSet< std::string > managedTypes;
52};
[16ba4a6f]53
[02c7d04]54} // namespace
[48e99f2]55
[51587aa]56// Local Variables: //
57// tab-width: 4 //
58// mode: c++ //
59// compile-command: "make install" //
60// End: //
Note: See TracBrowser for help on using the repository browser.