- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.h
rac9ca96 rb6fe7e6 67 67 virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr ); 68 68 virtual void visit( ConstructorExpr * ctorExpr ); 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. 69 public: // xxx - temporary hack - should make Tuples::TupleAssignment a friend 73 70 template< typename InputIterator, typename OutputIterator > 74 71 void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out ); 75 72 73 private: 76 74 /// Adds alternatives for member expressions, given the aggregate, conversion cost for that aggregate, and name of the member 77 template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member);75 template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, const std::string &name ); 78 76 /// Adds alternatives for offsetof expressions, given the base type and name of the member 79 77 template< typename StructOrUnionType > void addOffsetof( StructOrUnionType *aggInst, const std::string &name ); 80 bool instantiateFunction( std::list< DeclarationWithType* >& formals, const AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave, AltList & out);78 bool instantiateFunction( std::list< DeclarationWithType* >& formals, /*const*/ AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave ); 81 79 template< typename OutputIterator > 82 void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, constAltList &actualAlt, OutputIterator out );80 void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, AltList &actualAlt, OutputIterator out ); 83 81 template< typename OutputIterator > 84 82 void inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out ); … … 91 89 92 90 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 cost99 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 }122 91 } // namespace ResolvExpr 123 92
Note:
See TracChangeset
for help on using the changeset viewer.