- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.h
rb6fe7e6 rac9ca96 67 67 virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr ); 68 68 virtual void visit( ConstructorExpr * ctorExpr ); 69 public: // xxx - temporary hack - should make Tuples::TupleAssignment a friend 69 virtual void visit( TupleIndexExpr *tupleExpr ); 70 virtual void visit( TupleAssignExpr *tupleExpr ); 71 /// Runs a new alternative finder on each element in [begin, end) 72 /// and writes each alternative finder to out. 70 73 template< typename InputIterator, typename OutputIterator > 71 74 void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out ); 72 75 73 private:74 76 /// Adds alternatives for member expressions, given the aggregate, conversion cost for that aggregate, and name of the member 75 template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, const std::string &name);77 template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ); 76 78 /// Adds alternatives for offsetof expressions, given the base type and name of the member 77 79 template< typename StructOrUnionType > void addOffsetof( StructOrUnionType *aggInst, const std::string &name ); 78 bool instantiateFunction( std::list< DeclarationWithType* >& formals, /*const*/ AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave);80 bool instantiateFunction( std::list< DeclarationWithType* >& formals, const AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave, AltList & out ); 79 81 template< typename OutputIterator > 80 void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, AltList &actualAlt, OutputIterator out );82 void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, const AltList &actualAlt, OutputIterator out ); 81 83 template< typename OutputIterator > 82 84 void inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out ); … … 89 91 90 92 Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env ); 93 94 template< typename InputIterator, typename OutputIterator > 95 void findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) { 96 AltList alternatives; 97 98 // select the alternatives that have the minimum parameter cost 99 Cost minCost = Cost::infinity; 100 for ( InputIterator i = begin; i != end; ++i ) { 101 if ( i->cost < minCost ) { 102 minCost = i->cost; 103 i->cost = i->cvtCost; 104 alternatives.clear(); 105 alternatives.push_back( *i ); 106 } else if ( i->cost == minCost ) { 107 i->cost = i->cvtCost; 108 alternatives.push_back( *i ); 109 } 110 } 111 std::copy( alternatives.begin(), alternatives.end(), out ); 112 } 113 114 Cost sumCost( const AltList &in ); 115 116 template< typename InputIterator > 117 void simpleCombineEnvironments( InputIterator begin, InputIterator end, TypeEnvironment &result ) { 118 while ( begin != end ) { 119 result.simpleCombine( (*begin++).env ); 120 } 121 } 91 122 } // namespace ResolvExpr 92 123
Note:
See TracChangeset
for help on using the changeset viewer.