source: src/ResolvExpr/Unify.h @ d76c588

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

Stubs for new resolver, implementation of new indexer, type environment

  • Property mode set to 100644
File size: 3.4 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// Unify.h --
8//
9// Author           : Richard C. Bilson
10// Created On       : Sun May 17 13:09:04 2015
11// Last Modified By : Aaron B. Moss
12// Last Modified On : Mon Jun 18 11:58:00 2018
13// Update Count     : 4
14//
15
16#pragma once
17
18#include <list>                   // for list
19
20#include "AST/TypeEnvironment.hpp"  // for TypeEnvironment, AssertionSet, OpenVarSet
21#include "Common/utility.h"       // for deleteAll
22#include "SynTree/Declaration.h"  // for TypeDecl, TypeDecl::Data
23#include "TypeEnvironment.h"      // for AssertionSet, OpenVarSet
24#include "WidenMode.h"              // for WidenMode
25
26class Type;
27class TypeInstType;
28namespace SymTab {
29        class Indexer;
30}
31
32namespace ast {
33        class SymbolTable;
34        class Type;
35}
36
37namespace ResolvExpr {
38        bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer );
39        bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer, Type *&commonType );
40        bool unifyExact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer );
41        bool unifyInexact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer, Type *&common );
42
43        template< typename Iterator1, typename Iterator2 >
44        bool unifyList( Iterator1 list1Begin, Iterator1 list1End, Iterator2 list2Begin, Iterator2 list2End, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer, std::list< Type* > &commonTypes ) {
45                for ( ; list1Begin != list1End && list2Begin != list2End; ++list1Begin, ++list2Begin ) {
46                        Type *commonType = 0;
47                        if ( ! unify( *list1Begin, *list2Begin, env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
48                                return false;
49                        } // if
50                        commonTypes.push_back( commonType );
51                } // for
52                if ( list1Begin != list1End || list2Begin != list2End ) {
53                        return false;
54                } else {
55                        return true;
56                } // if
57        }
58
59        template< typename Iterator1, typename Iterator2 >
60        bool unifyList( Iterator1 list1Begin, Iterator1 list1End, Iterator2 list2Begin, Iterator2 list2End, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer ) {
61                std::list< Type* > commonTypes;
62                if ( unifyList( list1Begin, list1End, list2Begin, list2End, env, needAssertions, haveAssertions, openVars, indexer, commonTypes ) ) {
63                        deleteAll( commonTypes );
64                        return true;
65                } else {
66                        return false;
67                } // if
68        }
69
70        bool unifyInexact( 
71                const ast::Type * type1, const ast::Type * type2, ast::TypeEnvironment & env, 
72                ast::AssertionSet & need, ast::AssertionSet & have, const ast::OpenVarSet & openVars, 
73                WidenMode widenMode, const ast::SymbolTable & symtab, const ast::Type *& common );
74
75} // namespace ResolvExpr
76
77// Local Variables: //
78// tab-width: 4 //
79// mode: c++ //
80// compile-command: "make install" //
81// End: //
Note: See TracBrowser for help on using the repository browser.