source: src/ResolvExpr/AlternativeFinder.h@ f678663e

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay gc_noraii jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new string with_gc
Last change on this file since f678663e was 0f19d763, checked in by Aaron Moss <a3moss@…>, 10 years ago

Comments and indentation fixes

  • Property mode set to 100644
File size: 3.8 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// AlternativeFinder.h --
8//
9// Author : Richard C. Bilson
10// Created On : Sat May 16 23:56:12 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Sat May 16 23:58:43 2015
13// Update Count : 2
14//
15
16#ifndef ALTERNATIVEFINDER_H
17#define ALTERNATIVEFINDER_H
18
19#include <set>
20
21#include "Alternative.h"
22#include "Unify.h"
23#include "SynTree/SynTree.h"
24#include "SymTab/Indexer.h"
25#include "SynTree/TypeSubstitution.h"
26
27namespace ResolvExpr {
28 class AlternativeFinder : public Visitor {
29 public:
30 AlternativeFinder( const SymTab::Indexer &indexer, const TypeEnvironment &env );
31 void find( Expression *expr, bool adjust = false );
32 /// Calls find with the adjust flag set; adjustment turns array and function types into equivalent pointer types
33 void findWithAdjustment( Expression *expr );
34 AltList &get_alternatives() { return alternatives; }
35
36 // make this look like an STL container so that we can apply generic algorithms
37 typedef Alternative value_type;
38 typedef AltList::iterator iterator;
39 typedef AltList::const_iterator const_iterator;
40 AltList::iterator begin() { return alternatives.begin(); }
41 AltList::iterator end() { return alternatives.end(); }
42 AltList::const_iterator begin() const { return alternatives.begin(); }
43 AltList::const_iterator end() const { return alternatives.end(); }
44
45 const SymTab::Indexer &get_indexer() const { return indexer; }
46 const TypeEnvironment &get_environ() const { return env; }
47 private:
48 virtual void visit( ApplicationExpr *applicationExpr );
49 virtual void visit( UntypedExpr *untypedExpr );
50 virtual void visit( AddressExpr *addressExpr );
51 virtual void visit( CastExpr *castExpr );
52 virtual void visit( UntypedMemberExpr *memberExpr );
53 virtual void visit( MemberExpr *memberExpr );
54 virtual void visit( NameExpr *variableExpr );
55 virtual void visit( VariableExpr *variableExpr );
56 virtual void visit( ConstantExpr *constantExpr );
57 virtual void visit( SizeofExpr *sizeofExpr );
58 virtual void visit( AttrExpr *attrExpr );
59 virtual void visit( LogicalExpr *logicalExpr );
60 virtual void visit( ConditionalExpr *conditionalExpr );
61 virtual void visit( CommaExpr *commaExpr );
62 virtual void visit( TupleExpr *tupleExpr );
63 public: // xxx - temporary hack - should make Tuples::TupleAssignment a friend
64 template< typename InputIterator, typename OutputIterator >
65 void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out );
66
67 private:
68 template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const std::string &name );
69 bool instantiateFunction( std::list< DeclarationWithType* >& formals, /*const*/ AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave );
70 template< typename OutputIterator >
71 void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, AltList &actualAlt, OutputIterator out );
72 template< typename OutputIterator >
73 void inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out );
74 void resolveAttr( DeclarationWithType *funcDecl, FunctionType *function, Type *argType, const TypeEnvironment &env );
75
76 const SymTab::Indexer &indexer;
77 AltList alternatives;
78 const TypeEnvironment &env;
79 }; // AlternativeFinder
80
81 Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env );
82} // namespace ResolvExpr
83
84#endif // ALTERNATIVEFINDER_H
85
86// Local Variables: //
87// tab-width: 4 //
88// mode: c++ //
89// compile-command: "make install" //
90// End: //
Note: See TracBrowser for help on using the repository browser.