Changeset 954ef5b


Ignore:
Timestamp:
Oct 23, 2017, 5:39:11 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
f53836b
Parents:
aeef2bd
git-author:
Rob Schluntz <rschlunt@…> (10/23/17 17:37:05)
git-committer:
Rob Schluntz <rschlunt@…> (10/23/17 17:39:11)
Message:

Fix array-to-pointer decay to only decay one level

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AdjustExprType.cc

    raeef2bd r954ef5b  
    2828                void premutate( BasicType * ) { visit_children = false; }
    2929                void premutate( PointerType * ) { visit_children = false; }
     30                void premutate( ArrayType * ) { visit_children = false; }
    3031                void premutate( FunctionType * ) { visit_children = false; }
    3132                void premutate( StructInstType * ) { visit_children = false; }
     
    5960
    6061        Type * AdjustExprType::postmutate( ArrayType * arrayType ) {
    61                 // need to recursively mutate the base type in order for multi-dimensional arrays to work.
    6262                PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), arrayType->base );
    6363                arrayType->base = nullptr;
  • src/ResolvExpr/AlternativeFinder.cc

    raeef2bd r954ef5b  
    180180                        throw SemanticError( "No reasonable alternatives for expression ", expr );
    181181                }
    182                 for ( AltList::iterator i = alternatives.begin(); i != alternatives.end(); ++i ) {
    183                         if ( adjust ) {
    184                                 adjustExprType( i->expr->get_result(), i->env, indexer );
    185                         }
    186                 }
    187182                if ( prune ) {
    188183                        PRINT(
     
    206201                                std::cerr << "there are " << alternatives.size() << " alternatives after elimination" << std::endl;
    207202                        )
     203                }
     204                // adjust types after pruning so that types substituted by pruneAlternatives are correctly adjusted
     205                for ( AltList::iterator i = alternatives.begin(); i != alternatives.end(); ++i ) {
     206                        if ( adjust ) {
     207                                adjustExprType( i->expr->get_result(), i->env, indexer );
     208                        }
    208209                }
    209210
  • src/SymTab/FixFunction.cc

    raeef2bd r954ef5b  
    5050
    5151        void FixFunction::premutate(FunctionDecl *) { visit_children = false; }
     52        void FixFunction::premutate(ArrayType *) { visit_children = false; }
    5253        void FixFunction::premutate(BasicType *) { visit_children = false; }
    5354        void FixFunction::premutate(PointerType *) { visit_children = false; }
  • src/SymTab/FixFunction.h

    raeef2bd r954ef5b  
    3131                Type * postmutate(ArrayType * arrayType);
    3232
     33                void premutate(ArrayType * arrayType);
    3334                void premutate(VoidType * voidType);
    3435                void premutate(BasicType * basicType);
Note: See TracChangeset for help on using the changeset viewer.