Changes in / [0df292b:721f17a]
- Location:
- src/ResolvExpr
- Files:
-
- 6 edited
-
AlternativeFinder.cc (modified) (2 diffs)
-
AlternativeFinder.h (modified) (1 diff)
-
FindOpenVars.h (modified) (1 diff)
-
RenameVars.cc (modified) (3 diffs)
-
RenameVars.h (modified) (1 diff)
-
Unify.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
r0df292b r721f17a 89 89 }; 90 90 91 /// Prunes a list of alternatives down to those that have the minimum conversion cost for a given return type; skips ambiguous interpretations92 91 template< typename InputIterator, typename OutputIterator > 93 92 void pruneAlternatives( InputIterator begin, InputIterator end, OutputIterator out, const SymTab::Indexer &indexer ) { … … 354 353 355 354 bool AlternativeFinder::instantiateFunction( std::list< DeclarationWithType* >& formals, /*const*/ AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave ) { 355 std::list< TypeEnvironment > toBeDone; 356 356 simpleCombineEnvironments( actuals.begin(), actuals.end(), resultEnv ); 357 357 // make sure we don't widen any existing bindings -
src/ResolvExpr/AlternativeFinder.h
r0df292b r721f17a 30 30 AlternativeFinder( const SymTab::Indexer &indexer, const TypeEnvironment &env ); 31 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 types33 32 void findWithAdjustment( Expression *expr ); 34 33 AltList &get_alternatives() { return alternatives; } -
src/ResolvExpr/FindOpenVars.h
r0df292b r721f17a 21 21 22 22 namespace ResolvExpr { 23 // Updates open and closed variables and their associated assertions24 23 void findOpenVars( Type *type, OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen ); 25 24 } // namespace ResolvExpr -
src/ResolvExpr/RenameVars.cc
r0df292b r721f17a 118 118 /// type->print( std::cout ); 119 119 /// std::cout << std::endl; 120 // copies current name mapping into new mapping121 120 mapStack.push_front( mapStack.front() ); 122 // renames all "forall" type names to `_${level}_${name}'123 121 for ( std::list< TypeDecl* >::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) { 124 122 std::ostringstream output; … … 127 125 mapStack.front()[ (*i)->get_name() ] = newname; 128 126 (*i)->set_name( newname ); 129 // ditto for assertion names, the next level in130 127 level++; 131 128 acceptAll( (*i)->get_assertions(), *this ); … … 135 132 136 133 void RenameVars::typeAfter( Type *type ) { 137 // clears name mapping added by typeBefore()138 134 if ( ! type->get_forall().empty() ) { 139 135 mapStack.pop_front(); -
src/ResolvExpr/RenameVars.h
r0df292b r721f17a 25 25 26 26 namespace ResolvExpr { 27 28 /// Provides a consistent renaming of forall type names in a hierarchy by prefixing them with a unique "level" ID29 27 class RenameVars : public Visitor { 30 28 public: -
src/ResolvExpr/Unify.cc
r0df292b r721f17a 73 73 }; 74 74 75 /// Attempts an inexact unification of type1 and type2.76 /// Returns false if no such unification; if the types can be unified, sets common (unless they unify exactly and have identical type qualifiers)77 75 bool unifyInexact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer, Type *&common ); 78 76 bool unifyExact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ); … … 150 148 if ( curClass.type ) { 151 149 Type *common = 0; 152 // attempt to unify equivalence class type (which has qualifiers stripped, so they must be restored) with the type to bind to153 150 std::auto_ptr< Type > newType( curClass.type->clone() ); 154 151 newType->get_qualifiers() = typeInst->get_qualifiers(); … … 283 280 TypeEnvironment debugEnv( env ); 284 281 #endif 285 if ( type1->get_qualifiers() != type2->get_qualifiers() ) {286 return false;287 }288 289 282 bool result; 290 283 TypeInstType *var1 = dynamic_cast< TypeInstType* >( type1 ); … … 299 292 bool isopen1 = var1 && ( entry1 != openVars.end() ); 300 293 bool isopen2 = var2 && ( entry2 != openVars.end() ); 301 302 if ( isopen1 && isopen2 && entry1->second == entry2->second ) { 294 if ( type1->get_qualifiers() != type2->get_qualifiers() ) { 295 return false; 296 } else if ( isopen1 && isopen2 && entry1->second == entry2->second ) { 303 297 result = bindVarToVar( var1, var2, entry1->second, env, needAssertions, haveAssertions, openVars, widenMode, indexer ); 304 298 } else if ( isopen1 ) {
Note:
See TracChangeset
for help on using the changeset viewer.