Ignore:
Timestamp:
Aug 20, 2020, 11:48:15 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
d685cb0
Parents:
67ca73e (diff), 013b028 (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:

fix conflicts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Autogen.h

    r67ca73e re67a82d  
    2121
    2222#include "AST/Decl.hpp"
     23#include "AST/Eval.hpp"
    2324#include "AST/Expr.hpp"
    2425#include "AST/Init.hpp"
     
    265266                }
    266267
    267                 ast::ptr< ast::Expr > begin, end, cmp, update;
     268                ast::ptr< ast::Expr > begin, end;
     269                std::string cmp, update;
    268270
    269271                if ( forward ) {
     
    271273                        begin = ast::ConstantExpr::from_int( loc, 0 );
    272274                        end = array->dimension;
    273                         cmp = new ast::NameExpr{ loc, "?<?" };
    274                         update = new ast::NameExpr{ loc, "++?" };
     275                        cmp = "?<?";
     276                        update = "++?";
    275277                } else {
    276278                        // generate: for ( int i = N-1; i >= 0; --i )
    277                         begin = new ast::UntypedExpr{
    278                                 loc, new ast::NameExpr{ loc, "?-?" },
    279                                 { array->dimension, ast::ConstantExpr::from_int( loc, 1 ) } };
     279                        begin = ast::call(
     280                                loc, "?-?", array->dimension, ast::ConstantExpr::from_int( loc, 1 ) );
    280281                        end = ast::ConstantExpr::from_int( loc, 0 );
    281                         cmp = new ast::NameExpr{ loc, "?>=?" };
    282                         update = new ast::NameExpr{ loc, "--?" };
     282                        cmp = "?>=?";
     283                        update = "--?";
    283284                }
    284285
     
    286287                        loc, indexName.newName(), new ast::BasicType{ ast::BasicType::SignedInt },
    287288                        new ast::SingleInit{ loc, begin } };
    288                
    289                 ast::ptr< ast::Expr > cond = new ast::UntypedExpr{
    290                         loc, cmp, { new ast::VariableExpr{ loc, index }, end } };
    291                
    292                 ast::ptr< ast::Expr > inc = new ast::UntypedExpr{
    293                         loc, update, { new ast::VariableExpr{ loc, index } } };
    294                
    295                 ast::ptr< ast::Expr > dstIndex = new ast::UntypedExpr{
    296                         loc, new ast::NameExpr{ loc, "?[?]" },
    297                         { dstParam, new ast::VariableExpr{ loc, index } } };
     289                ast::ptr< ast::Expr > indexVar = new ast::VariableExpr{ loc, index };
     290               
     291                ast::ptr< ast::Expr > cond = ast::call( loc, cmp, indexVar, end );
     292               
     293                ast::ptr< ast::Expr > inc = ast::call( loc, update, indexVar );
     294               
     295                ast::ptr< ast::Expr > dstIndex = ast::call( loc, "?[?]", dstParam, indexVar );
    298296               
    299297                // srcParam must keep track of the array indices to build the source parameter and/or
    300298                // array list initializer
    301                 srcParam.addArrayIndex( new ast::VariableExpr{ loc, index }, array->dimension );
     299                srcParam.addArrayIndex( indexVar, array->dimension );
    302300
    303301                // for stmt's body, eventually containing call
     
    385383                if ( isUnnamedBitfield( obj ) ) return {};
    386384
    387                 ast::ptr< ast::Type > addCast = nullptr;
     385                ast::ptr< ast::Type > addCast;
    388386                if ( (fname == "?{}" || fname == "^?{}") && ( ! obj || ( obj && ! obj->bitfieldWidth ) ) ) {
    389387                        assert( dstParam->result );
Note: See TracChangeset for help on using the changeset viewer.