source: src/InitTweak/GenInit.h @ 2da12ae

Last change on this file since 2da12ae was c6b4432, checked in by Andrew Beach <ajbeach@…>, 12 months ago

Remove BaseSyntaxNode? and clean-up.

  • Property mode set to 100644
File size: 2.1 KB
Line 
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//
7// GenInit.h -- Generate initializers, and other stuff.
8//
9// Author           : Rodolfo G. Esteves
10// Created On       : Mon May 18 07:44:20 2015
11// Last Modified By : Andrew Beach
12// Last Modified On : Fri Mar 18 14:22:00 2022
13// Update Count     : 7
14//
15
16#pragma once
17
18#include <list>                // for list
19#include <string>              // for string
20
21#include "AST/Fwd.hpp"
22#include "Common/CodeLocation.h"
23#include "GenPoly/ScopedSet.h" // for ScopedSet
24
25namespace InitTweak {
26        /// Adds return value temporaries and wraps Initializers in ConstructorInit nodes
27        void genInit( ast::TranslationUnit & translationUnit );
28
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 );
32
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);
35
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 );
38
39        class ManagedTypes_new {
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
43
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
46
47                void beginScope();
48                void endScope();
49        private:
50                GenPoly::ScopedSet< std::string > managedTypes;
51        };
52} // namespace
53
54// Local Variables: //
55// tab-width: 4 //
56// mode: c++ //
57// compile-command: "make install" //
58// End: //
Note: See TracBrowser for help on using the repository browser.