Changeset b3f252a for src/ResolvExpr/AlternativeFinder.cc
- Timestamp:
- Sep 7, 2017, 10:36:35 AM (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:
- e0886db
- Parents:
- 871cdb4 (diff), 416cc86 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
r871cdb4 rb3f252a 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sat May 16 23:52:08 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Wed Jul 26 11:33:00201713 // Update Count : 3 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Aug 28 13:47:24 2017 13 // Update Count : 32 14 14 // 15 15 … … 195 195 AltList winners; 196 196 findMinCost( alternatives.begin(), alternatives.end(), back_inserter( winners ) ); 197 stream << "Can 't choose between " << winners.size() << " alternatives for expression ";197 stream << "Cannot choose between " << winners.size() << " alternatives for expression "; 198 198 expr->print( stream ); 199 199 stream << "Alternatives are:"; … … 698 698 699 699 void AlternativeFinder::visit( UntypedExpr *untypedExpr ) { 700 {701 std::string fname = InitTweak::getFunctionName( untypedExpr );702 if ( fname == "&&" ) {703 VoidType v = Type::Qualifiers(); // resolve to type void *704 PointerType pt( Type::Qualifiers(), v.clone() );705 UntypedExpr *vexpr = untypedExpr->clone();706 vexpr->set_result( pt.clone() );707 alternatives.push_back( Alternative( vexpr, env, Cost::zero) );708 return;709 }710 }711 712 700 AlternativeFinder funcFinder( indexer, env ); 713 701 funcFinder.findWithAdjustment( untypedExpr->get_function() ); … … 749 737 if ( PointerType *pointer = dynamic_cast< PointerType* >( func->expr->get_result()->stripReferences() ) ) { 750 738 if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) { 751 referenceToRvalueConversion( func->expr ); 739 Alternative newFunc( *func ); 740 referenceToRvalueConversion( newFunc.expr ); 752 741 for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) { 753 742 // XXX 754 743 //Designators::check_alternative( function, *actualAlt ); 755 makeFunctionAlternatives( *func, function, *actualAlt, std::back_inserter( candidates ) );744 makeFunctionAlternatives( newFunc, function, *actualAlt, std::back_inserter( candidates ) ); 756 745 } 757 746 } 758 747 } else if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( func->expr->get_result()->stripReferences() ) ) { // handle ftype (e.g. *? on function pointer) 759 referenceToRvalueConversion( func->expr );760 748 EqvClass eqvClass; 761 749 if ( func->env.lookup( typeInst->get_name(), eqvClass ) && eqvClass.type ) { 762 750 if ( FunctionType *function = dynamic_cast< FunctionType* >( eqvClass.type ) ) { 751 Alternative newFunc( *func ); 752 referenceToRvalueConversion( newFunc.expr ); 763 753 for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) { 764 makeFunctionAlternatives( *func, function, *actualAlt, std::back_inserter( candidates ) );754 makeFunctionAlternatives( newFunc, function, *actualAlt, std::back_inserter( candidates ) ); 765 755 } // for 766 756 } // if … … 773 763 if ( PointerType *pointer = dynamic_cast< PointerType* >( funcOp->expr->get_result()->stripReferences() ) ) { 774 764 if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) { 775 referenceToRvalueConversion( funcOp->expr ); 765 Alternative newFunc( *funcOp ); 766 referenceToRvalueConversion( newFunc.expr ); 776 767 for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) { 777 768 AltList currentAlt; 778 769 currentAlt.push_back( *func ); 779 770 currentAlt.insert( currentAlt.end(), actualAlt->begin(), actualAlt->end() ); 780 makeFunctionAlternatives( *funcOp, function, currentAlt, std::back_inserter( candidates ) );771 makeFunctionAlternatives( newFunc, function, currentAlt, std::back_inserter( candidates ) ); 781 772 } // for 782 773 } // if … … 853 844 } // if 854 845 } // for 846 } 847 848 void AlternativeFinder::visit( LabelAddressExpr * expr ) { 849 alternatives.push_back( Alternative( expr->clone(), env, Cost::zero) ); 855 850 } 856 851
Note:
See TracChangeset
for help on using the changeset viewer.