source: src/ResolvExpr/Unify.h @ 4cdfcbd

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 4cdfcbd was d286cf68, checked in by Aaron Moss <a3moss@…>, 6 years ago

Fix TypeEnvironment? bind algorithms

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