Changeset bf7b6015


Ignore:
Timestamp:
Feb 6, 2018, 4:40:28 PM (6 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:
53d3ab4b
Parents:
51b5a02
Message:

Move pointer cast out past address expression [fixes #67]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Lvalue.cc

    r51b5a02 rbf7b6015  
    465465                                        return ret;
    466466                                }
     467                        } else if ( CastExpr * castExpr = dynamic_cast< CastExpr * > ( arg ) ) {
     468                                // need to move cast to pointer type out a level since address of pointer
     469                                // is not valid C code (can be introduced in prior passes, e.g., InstantiateGeneric)
     470                                if ( InitTweak::getPointerBase( castExpr->result ) ) {
     471                                        addrExpr->arg = castExpr->arg;
     472                                        castExpr->arg = addrExpr;
     473                                        castExpr->result = new PointerType( Type::Qualifiers(), castExpr->result );
     474                                        return castExpr;
     475                                }
    467476                        }
    468477                        return addrExpr;
Note: See TracChangeset for help on using the changeset viewer.