source: src/Tuples/Tuples.h @ 9b4f329

ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 9b4f329 was 9b4f329, checked in by Aaron Moss <a3moss@…>, 5 years ago

Finished porting AST::Expr subclasses

  • 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// Tuples.h --
8//
9// Author           : Rodolfo G. Esteves
10// Created On       : Mon May 18 07:44:20 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Sat Jul 22 09:55:00 2017
13// Update Count     : 16
14//
15
16#pragma once
17
18#include <string>
19#include <vector>
20
21#include "AST/Fwd.hpp"
22#include "AST/Node.hpp"
23#include "SynTree/Expression.h"
24#include "SynTree/Declaration.h"
25#include "SynTree/Type.h"
26
27#include "ResolvExpr/AlternativeFinder.h"
28
29namespace Tuples {
30        // TupleAssignment.cc
31        void handleTupleAssignment( ResolvExpr::AlternativeFinder & currentFinder, UntypedExpr * assign, 
32                std::vector< ResolvExpr::AlternativeFinder >& args );
33       
34        // TupleExpansion.cc
35        /// expands z.[a, b.[x, y], c] into [z.a, z.b.x, z.b.y, z.c], inserting UniqueExprs as appropriate
36        void expandMemberTuples( std::list< Declaration * > & translationUnit );
37
38        /// replaces tuple-related elements, such as TupleType, TupleExpr, TupleAssignExpr, etc.
39        void expandTuples( std::list< Declaration * > & translationUnit );
40
41        /// replaces UniqueExprs with a temporary variable and one call
42        void expandUniqueExpr( std::list< Declaration * > & translationUnit );
43
44        /// returns VoidType if any of the expressions have Voidtype, otherwise TupleType of the Expression result types
45        Type * makeTupleType( const std::list< Expression * > & exprs );
46        const ast::Type * makeTupleType( const std::vector<ast::ptr<ast::Expr>> & exprs );
47
48        /// returns a TypeInstType if `type` is a ttype, nullptr otherwise
49        TypeInstType * isTtype( Type * type );
50
51        /// returns true if the expression may contain side-effects.
52        bool maybeImpure( Expression * expr );
53
54        /// returns true if the expression may contain side-effect, ignoring the presence of unique expressions.
55        bool maybeImpureIgnoreUnique( Expression * expr );
56} // namespace Tuples
57
58// Local Variables: //
59// tab-width: 4 //
60// mode: c++ //
61// compile-command: "make install" //
62// End: //
Note: See TracBrowser for help on using the repository browser.