Changeset 421edab for src


Ignore:
Timestamp:
Jan 21, 2016, 4:40:58 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
567bb17
Parents:
05d47278 (diff), 803deb1 (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 changes from master

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r05d47278 r421edab  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Thu Sep 17 15:24:08 2015
    13 // Update Count     : 231
     12// Last Modified On : Wed Jan 20 12:54:50 2016
     13// Update Count     : 241
    1414//
    1515
     
    392392
    393393        void CodeGenerator::visit( CastExpr *castExpr ) {
    394                 // if the cast is to an lvalue type, then the cast
    395                 // should be dropped, since the result of a cast is
    396                 // never an lvalue in C
    397                 if ( castExpr->get_results().front()->get_isLvalue() ) {
    398                         castExpr->get_arg()->accept( *this );
    399                 } else {
    400                         output << "((";
    401                         if ( castExpr->get_results().empty() ) {
    402                                 output << "void" ;
    403                         } else {
    404                                 output << genType( castExpr->get_results().front(), "" );
    405                         } // if
     394                output << "(";
     395                if ( castExpr->get_results().empty() ) {
     396                        output << "(void)" ;
     397                } else if ( ! castExpr->get_results().front()->get_isLvalue() ) {
     398                        // at least one result type of cast, but not an lvalue
     399                        output << "(";
     400                        output << genType( castExpr->get_results().front(), "" );
    406401                        output << ")";
    407                         castExpr->get_arg()->accept( *this );
    408                         output << ")";                 
     402                } else {
     403                        // otherwise, the cast is to an lvalue type, so the cast
     404                        // should be dropped, since the result of a cast is
     405                        // never an lvalue in C
    409406                }
     407                castExpr->get_arg()->accept( *this );
     408                output << ")";
    410409        }
    411410 
  • src/GenPoly/Specialize.cc

    r05d47278 r421edab  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Specialize.cc -- 
     7// Specialize.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue Sep 22 14:04:13 2015
    13 // Update Count     : 15
     12// Last Modified On : Wed Jan 20 12:40:33 2016
     13// Update Count     : 18
    1414//
    1515
     
    140140                return new AddressExpr( new VariableExpr( thunkFunc ) );
    141141        }
    142        
     142
    143143        Expression * Specialize::doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams ) {
     144                assert( ! actual->get_results().empty() );
    144145                if ( needsSpecialization( formalType, actual->get_results().front(), env ) ) {
    145146                        FunctionType *funType;
     
    198199        Expression * Specialize::mutate( CastExpr *castExpr ) {
    199200                castExpr->get_arg()->acceptMutator( *this );
     201                if ( castExpr->get_results().empty() ) {
     202                        // can't specialize if we don't have a return value
     203                        return castExpr;
     204                }
    200205                Expression *specialized = doSpecialization( castExpr->get_results().front(), castExpr->get_arg() );
    201206                if ( specialized != castExpr->get_arg() ) {
Note: See TracChangeset for help on using the changeset viewer.