Changeset cd7ef0b for src/GenPoly/Box.cc


Ignore:
Timestamp:
Aug 10, 2017, 3:39:11 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:
38d70ab
Parents:
275f4b4 (diff), e1780a2 (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/GenPoly/Box.cc

    r275f4b4 rcd7ef0b  
    2727#include "Box.h"
    2828#include "DeclMutator.h"
     29#include "Lvalue.h"
     30#include "FindFunction.h"
    2931#include "PolyMutator.h"
    30 #include "FindFunction.h"
    3132#include "ScopedSet.h"
    3233#include "ScrubTyVars.h"
     
    755756
    756757                void Pass1::boxParam( Type *param, Expression *&arg, const TyVarMap &exprTyVars ) {
    757                         assert( arg->has_result() );
     758                        assertf( arg->has_result(), "arg does not have result: %s", toString( arg ).c_str() );
    758759                        if ( isPolyType( param, exprTyVars ) ) {
    759                                 if ( isPolyType( arg->get_result() ) ) {
     760                                Type * newType = arg->get_result()->clone();
     761                                if ( env ) env->apply( newType );
     762                                std::auto_ptr<Type> manager( newType );
     763                                if ( isPolyType( newType ) ) {
    760764                                        // if the argument's type is polymorphic, we don't need to box again!
    761765                                        return;
    762766                                } else if ( arg->get_result()->get_lvalue() ) {
    763                                         // VariableExpr and MemberExpr are lvalues; need to check this isn't coming from the second arg of a comma expression though (not an lvalue)
    764                                         // xxx - need to test that this code is still reachable
    765                                         if ( CommaExpr *commaArg = dynamic_cast< CommaExpr* >( arg ) ) {
    766                                                 commaArg->set_arg2( new AddressExpr( commaArg->get_arg2() ) );
    767                                         } else {
    768                                                 arg = new AddressExpr( arg );
    769                                         }
     767                                        // argument expression may be CFA lvalue, but not C lvalue -- apply generalizedLvalue transformations.
     768                                        arg =  generalizedLvalue( new AddressExpr( arg ) );
    770769                                        if ( ! ResolvExpr::typesCompatible( param, arg->get_result(), SymTab::Indexer() ) ) {
    771770                                                // silence warnings by casting boxed parameters when the actual type does not match up with the formal type.
     
    18791878                        return structDecl;
    18801879                }
    1881                
     1880
    18821881                Declaration *Pass3::mutate( UnionDecl *unionDecl ) {
    18831882                        stripGenericMembers( unionDecl );
Note: See TracChangeset for help on using the changeset viewer.