Ignore:
Timestamp:
Nov 8, 2017, 5:43:33 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
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:
954908d
Parents:
78315272 (diff), e35f30a (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/Unify.cc

    r78315272 r3f7e12cb  
    1717#include <iterator>               // for back_insert_iterator, back_inserter
    1818#include <map>                    // for _Rb_tree_const_iterator, _Rb_tree_i...
    19 #include <memory>                 // for unique_ptr, auto_ptr
     19#include <memory>                 // for unique_ptr
    2020#include <set>                    // for set
    2121#include <string>                 // for string, operator==, operator!=, bas...
    2222#include <utility>                // for pair
    2323
     24#include "Common/PassVisitor.h"   // for PassVisitor
    2425#include "FindOpenVars.h"         // for findOpenVars
    2526#include "Parser/LinkageSpec.h"   // for C
     
    137138        bool tyVarCompatible( const TypeDecl::Data & data, Type *type ) {
    138139                switch ( data.kind ) {
    139                   case TypeDecl::Any:
    140140                  case TypeDecl::Dtype:
    141141                        // to bind to an object type variable, the type must not be a function type.
     
    169169                                Type *common = 0;
    170170                                // attempt to unify equivalence class type (which has qualifiers stripped, so they must be restored) with the type to bind to
    171                                 std::auto_ptr< Type > newType( curClass.type->clone() );
     171                                std::unique_ptr< Type > newType( curClass.type->clone() );
    172172                                newType->get_qualifiers() = typeInst->get_qualifiers();
    173173                                if ( unifyInexact( newType.get(), other, env, needAssertions, haveAssertions, openVars, widenMode & WidenMode( curClass.allowWidening, true ), indexer, common ) ) {
     
    458458                if ( otherArray && arrayType->get_isVarLen() == otherArray->get_isVarLen() ) {
    459459
    460                         // not positive this is correct in all cases, but it's needed for typedefs
    461                         if ( arrayType->get_isVarLen() || otherArray->get_isVarLen() ) {
    462                                 return;
    463                         }
    464 
    465460                        if ( ! arrayType->get_isVarLen() && ! otherArray->get_isVarLen() &&
    466461                                arrayType->get_dimension() != 0 && otherArray->get_dimension() != 0 ) {
     
    537532        /// If this isn't done then argument lists can have wildly different
    538533        /// size and structure, when they should be compatible.
    539         struct TtypeExpander : public Mutator {
    540                 TypeEnvironment & env;
    541                 TtypeExpander( TypeEnvironment & env ) : env( env ) {}
    542                 Type * mutate( TypeInstType * typeInst ) {
     534        struct TtypeExpander : public WithShortCircuiting {
     535                TypeEnvironment & tenv;
     536                TtypeExpander( TypeEnvironment & tenv ) : tenv( tenv ) {}
     537                void premutate( TypeInstType * ) { visit_children = false; }
     538                Type * postmutate( TypeInstType * typeInst ) {
    543539                        EqvClass eqvClass;
    544                         if ( env.lookup( typeInst->get_name(), eqvClass ) ) {
     540                        if ( tenv.lookup( typeInst->get_name(), eqvClass ) ) {
    545541                                if ( eqvClass.data.kind == TypeDecl::Ttype ) {
    546542                                        // expand ttype parameter into its actual type
     
    560556                dst.clear();
    561557                for ( DeclarationWithType * dcl : src ) {
    562                         TtypeExpander expander( env );
     558                        PassVisitor<TtypeExpander> expander( env );
    563559                        dcl->acceptMutator( expander );
    564560                        std::list< Type * > types;
     
    750746                        std::list<Type *> types1, types2;
    751747
    752                         TtypeExpander expander( env );
     748                        PassVisitor<TtypeExpander> expander( env );
    753749                        flat1->acceptMutator( expander );
    754750                        flat2->acceptMutator( expander );
Note: See TracChangeset for help on using the changeset viewer.