Ignore:
Timestamp:
Sep 7, 2017, 10:36:35 AM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.cc

    r871cdb4 rb3f252a  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sat May 16 23:52:08 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jul 26 11:33:00 2017
    13 // Update Count     : 31
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Aug 28 13:47:24 2017
     13// Update Count     : 32
    1414//
    1515
     
    195195                                AltList winners;
    196196                                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 ";
    198198                                expr->print( stream );
    199199                                stream << "Alternatives are:";
     
    698698
    699699        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 
    712700                AlternativeFinder funcFinder( indexer, env );
    713701                funcFinder.findWithAdjustment( untypedExpr->get_function() );
     
    749737                                if ( PointerType *pointer = dynamic_cast< PointerType* >( func->expr->get_result()->stripReferences() ) ) {
    750738                                        if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) {
    751                                                 referenceToRvalueConversion( func->expr );
     739                                                Alternative newFunc( *func );
     740                                                referenceToRvalueConversion( newFunc.expr );
    752741                                                for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) {
    753742                                                        // XXX
    754743                                                        //Designators::check_alternative( function, *actualAlt );
    755                                                         makeFunctionAlternatives( *func, function, *actualAlt, std::back_inserter( candidates ) );
     744                                                        makeFunctionAlternatives( newFunc, function, *actualAlt, std::back_inserter( candidates ) );
    756745                                                }
    757746                                        }
    758747                                } else if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( func->expr->get_result()->stripReferences() ) ) { // handle ftype (e.g. *? on function pointer)
    759                                         referenceToRvalueConversion( func->expr );
    760748                                        EqvClass eqvClass;
    761749                                        if ( func->env.lookup( typeInst->get_name(), eqvClass ) && eqvClass.type ) {
    762750                                                if ( FunctionType *function = dynamic_cast< FunctionType* >( eqvClass.type ) ) {
     751                                                        Alternative newFunc( *func );
     752                                                        referenceToRvalueConversion( newFunc.expr );
    763753                                                        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 ) );
    765755                                                        } // for
    766756                                                } // if
     
    773763                                        if ( PointerType *pointer = dynamic_cast< PointerType* >( funcOp->expr->get_result()->stripReferences() ) ) {
    774764                                                if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) {
    775                                                         referenceToRvalueConversion( funcOp->expr );
     765                                                        Alternative newFunc( *funcOp );
     766                                                        referenceToRvalueConversion( newFunc.expr );
    776767                                                        for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) {
    777768                                                                AltList currentAlt;
    778769                                                                currentAlt.push_back( *func );
    779770                                                                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 ) );
    781772                                                        } // for
    782773                                                } // if
     
    853844                        } // if
    854845                } // for
     846        }
     847
     848        void AlternativeFinder::visit( LabelAddressExpr * expr ) {
     849                alternatives.push_back( Alternative( expr->clone(), env, Cost::zero) );
    855850        }
    856851
Note: See TracChangeset for help on using the changeset viewer.