Changeset 0df292b


Ignore:
Timestamp:
Jun 26, 2015, 11:48:28 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, ctor, deferred_resn, demangler, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, string, with_gc
Children:
2871210
Parents:
721f17a (diff), 937e51d (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 plg2:software/cfa/cfa-cc

Location:
src/ResolvExpr
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.cc

    r721f17a r0df292b  
    8989                };
    9090
     91                /// Prunes a list of alternatives down to those that have the minimum conversion cost for a given return type; skips ambiguous interpretations
    9192                template< typename InputIterator, typename OutputIterator >
    9293                void pruneAlternatives( InputIterator begin, InputIterator end, OutputIterator out, const SymTab::Indexer &indexer ) {
     
    353354
    354355        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;
    356356                simpleCombineEnvironments( actuals.begin(), actuals.end(), resultEnv );
    357357                // make sure we don't widen any existing bindings
  • src/ResolvExpr/AlternativeFinder.h

    r721f17a r0df292b  
    3030                AlternativeFinder( const SymTab::Indexer &indexer, const TypeEnvironment &env );
    3131                void find( Expression *expr, bool adjust = false );
     32                /// Calls find with the adjust flag set; adjustment turns array and function types into equivalent pointer types
    3233                void findWithAdjustment( Expression *expr );
    3334                AltList &get_alternatives() { return alternatives; }
  • src/ResolvExpr/FindOpenVars.h

    r721f17a r0df292b  
    2121
    2222namespace ResolvExpr {
     23        // Updates open and closed variables and their associated assertions
    2324        void findOpenVars( Type *type, OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen );
    2425} // namespace ResolvExpr
  • src/ResolvExpr/RenameVars.cc

    r721f17a r0df292b  
    118118///     type->print( std::cout );
    119119///     std::cout << std::endl;
     120                        // copies current name mapping into new mapping
    120121                        mapStack.push_front( mapStack.front() );
     122                        // renames all "forall" type names to `_${level}_${name}'
    121123                        for ( std::list< TypeDecl* >::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
    122124                                std::ostringstream output;
     
    125127                                mapStack.front()[ (*i)->get_name() ] = newname;
    126128                                (*i)->set_name( newname );
     129                                // ditto for assertion names, the next level in
    127130                                level++;
    128131                                acceptAll( (*i)->get_assertions(), *this );
     
    132135
    133136        void RenameVars::typeAfter( Type *type ) {
     137                // clears name mapping added by typeBefore()
    134138                if ( ! type->get_forall().empty() ) {
    135139                        mapStack.pop_front();
  • src/ResolvExpr/RenameVars.h

    r721f17a r0df292b  
    2525
    2626namespace ResolvExpr {
     27
     28        /// Provides a consistent renaming of forall type names in a hierarchy by prefixing them with a unique "level" ID
    2729        class RenameVars : public Visitor {
    2830          public:
  • src/ResolvExpr/Unify.cc

    r721f17a r0df292b  
    7373        };
    7474
     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)
    7577        bool unifyInexact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer, Type *&common );
    7678        bool unifyExact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer );
     
    148150                        if ( curClass.type ) {
    149151                                Type *common = 0;
     152                                // attempt to unify equivalence class type (which has qualifiers stripped, so they must be restored) with the type to bind to
    150153                                std::auto_ptr< Type > newType( curClass.type->clone() );
    151154                                newType->get_qualifiers() = typeInst->get_qualifiers();
     
    280283                TypeEnvironment debugEnv( env );
    281284#endif
     285                if ( type1->get_qualifiers() != type2->get_qualifiers() ) {
     286                        return false;
     287                }
     288
    282289                bool result;
    283290                TypeInstType *var1 = dynamic_cast< TypeInstType* >( type1 );
     
    292299                bool isopen1 = var1 && ( entry1 != openVars.end() );
    293300                bool isopen2 = var2 && ( entry2 != openVars.end() );
    294                 if ( type1->get_qualifiers() != type2->get_qualifiers() ) {
    295                         return false;
    296                 } else if ( isopen1 && isopen2 && entry1->second == entry2->second ) {
     301
     302                if ( isopen1 && isopen2 && entry1->second == entry2->second ) {
    297303                        result = bindVarToVar( var1, var2, entry1->second, env, needAssertions, haveAssertions, openVars, widenMode, indexer );
    298304                } else if ( isopen1 ) {
Note: See TracChangeset for help on using the changeset viewer.