Changeset 579263a for src/ResolvExpr
- Timestamp:
- Jun 26, 2017, 4:48:35 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- bb1cd95
- Parents:
- e4d829b (diff), 2a7b3ca (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/ResolvExpr
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
re4d829b r579263a 97 97 /// Prunes a list of alternatives down to those that have the minimum conversion cost for a given return type; skips ambiguous interpretations 98 98 template< typename InputIterator, typename OutputIterator > 99 void pruneAlternatives( InputIterator begin, InputIterator end, OutputIterator out , const SymTab::Indexer &indexer) {99 void pruneAlternatives( InputIterator begin, InputIterator end, OutputIterator out ) { 100 100 // select the alternatives that have the minimum conversion cost for a particular set of result types 101 101 std::map< std::string, PruneStruct > selected; … … 183 183 ) 184 184 AltList::iterator oldBegin = alternatives.begin(); 185 pruneAlternatives( alternatives.begin(), alternatives.end(), front_inserter( alternatives ) , indexer);185 pruneAlternatives( alternatives.begin(), alternatives.end(), front_inserter( alternatives ) ); 186 186 if ( alternatives.begin() == oldBegin ) { 187 187 std::ostringstream stream; -
src/ResolvExpr/CommonType.cc
re4d829b r579263a 157 157 void CommonType::visit( PointerType *pointerType ) { 158 158 if ( PointerType *otherPointer = dynamic_cast< PointerType* >( type2 ) ) { 159 if ( widenFirst && dynamic_cast< VoidType* >( otherPointer->get_base() ) && ! isFtype(pointerType->get_base() , indexer) ) {159 if ( widenFirst && dynamic_cast< VoidType* >( otherPointer->get_base() ) && ! isFtype(pointerType->get_base()) ) { 160 160 getCommonWithVoidPointer( otherPointer, pointerType ); 161 } else if ( widenSecond && dynamic_cast< VoidType* >( pointerType->get_base() ) && ! isFtype(otherPointer->get_base() , indexer) ) {161 } else if ( widenSecond && dynamic_cast< VoidType* >( pointerType->get_base() ) && ! isFtype(otherPointer->get_base()) ) { 162 162 getCommonWithVoidPointer( pointerType, otherPointer ); 163 163 } else if ( ( pointerType->get_base()->get_qualifiers() >= otherPointer->get_base()->get_qualifiers() || widenFirst ) -
src/ResolvExpr/PtrsCastable.cc
re4d829b r579263a 135 135 } 136 136 137 void PtrsCastable::visit(TraitInstType *inst) { 138 // I definitely don't think we should be doing anything here 139 } 137 void PtrsCastable::visit( __attribute__((unused)) TraitInstType *inst ) {} 140 138 141 139 void PtrsCastable::visit(TypeInstType *inst) { -
src/ResolvExpr/Unify.cc
re4d829b r579263a 114 114 } 115 115 116 bool isFtype( Type *type , const SymTab::Indexer &indexer) {116 bool isFtype( Type *type ) { 117 117 if ( dynamic_cast< FunctionType* >( type ) ) { 118 118 return true; … … 123 123 } 124 124 125 bool tyVarCompatible( const TypeDecl::Data & data, Type *type , const SymTab::Indexer &indexer) {125 bool tyVarCompatible( const TypeDecl::Data & data, Type *type ) { 126 126 switch ( data.kind ) { 127 127 case TypeDecl::Any: … … 131 131 // type must also be complete 132 132 // xxx - should this also check that type is not a tuple type and that it's not a ttype? 133 return ! isFtype( type , indexer) && (! data.isComplete || type->isComplete() );133 return ! isFtype( type ) && (! data.isComplete || type->isComplete() ); 134 134 case TypeDecl::Ftype: 135 return isFtype( type , indexer);135 return isFtype( type ); 136 136 case TypeDecl::Ttype: 137 137 // ttype unifies with any tuple type … … 144 144 OpenVarSet::const_iterator tyvar = openVars.find( typeInst->get_name() ); 145 145 assert( tyvar != openVars.end() ); 146 if ( ! tyVarCompatible( tyvar->second, other , indexer) ) {146 if ( ! tyVarCompatible( tyvar->second, other ) ) { 147 147 return false; 148 148 } // if … … 388 388 } 389 389 390 void Unify::visit( VoidType *voidType) {390 void Unify::visit( __attribute__((unused)) VoidType *voidType) { 391 391 result = dynamic_cast< VoidType* >( type2 ); 392 392 } … … 683 683 684 684 template< typename Iterator1, typename Iterator2 > 685 bool unifyList( Iterator1 list1Begin, Iterator1 list1End, Iterator2 list2Begin, Iterator2 list2End, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode,const SymTab::Indexer &indexer ) {685 bool unifyList( Iterator1 list1Begin, Iterator1 list1End, Iterator2 list2Begin, Iterator2 list2End, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, const SymTab::Indexer &indexer ) { 686 686 auto get_type = [](Type * t) { return t; }; 687 687 for ( ; list1Begin != list1End && list2Begin != list2End; ++list1Begin, ++list2Begin ) { … … 733 733 flatten( flat2.get(), back_inserter( types2 ) ); 734 734 735 result = unifyList( types1.begin(), types1.end(), types2.begin(), types2.end(), env, needAssertions, haveAssertions, openVars, widenMode,indexer );736 } // if 737 } 738 739 void Unify::visit( VarArgsType *varArgsType) {735 result = unifyList( types1.begin(), types1.end(), types2.begin(), types2.end(), env, needAssertions, haveAssertions, openVars, indexer ); 736 } // if 737 } 738 739 void Unify::visit( __attribute__((unused)) VarArgsType *varArgsType ) { 740 740 result = dynamic_cast< VarArgsType* >( type2 ); 741 741 } 742 742 743 void Unify::visit( ZeroType *zeroType) {743 void Unify::visit( __attribute__((unused)) ZeroType *zeroType ) { 744 744 result = dynamic_cast< ZeroType* >( type2 ); 745 745 } 746 746 747 void Unify::visit( OneType *oneType) {747 void Unify::visit( __attribute__((unused)) OneType *oneType ) { 748 748 result = dynamic_cast< OneType* >( type2 ); 749 749 } -
src/ResolvExpr/typeops.h
re4d829b r579263a 118 118 119 119 // in Unify.cc 120 bool isFtype( Type *type , const SymTab::Indexer &indexer);120 bool isFtype( Type *type ); 121 121 bool typesCompatible( Type *, Type *, const SymTab::Indexer &indexer, const TypeEnvironment &env ); 122 122 bool typesCompatibleIgnoreQualifiers( Type *, Type *, const SymTab::Indexer &indexer, const TypeEnvironment &env );
Note:
See TracChangeset
for help on using the changeset viewer.