Changeset fcd17b2f for src/SynTree


Ignore:
Timestamp:
Jul 27, 2017, 2:56:39 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
874960b
Parents:
4d4e5de (diff), a04ce4d (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

Location:
src/SynTree
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/ApplicationExpr.cc

    r4d4e5de rfcd17b2f  
    4444}
    4545
    46 ApplicationExpr::ApplicationExpr( Expression *funcExpr ) : function( funcExpr ) {
     46ApplicationExpr::ApplicationExpr( Expression *funcExpr, const std::list< Expression * > & argList ) : function( funcExpr ), args( argList ) {
    4747        PointerType *pointer = safe_dynamic_cast< PointerType* >( funcExpr->get_result() );
    4848        FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
  • src/SynTree/Expression.cc

    r4d4e5de rfcd17b2f  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 30 16:41:13 2017
    13 // Update Count     : 52
     12// Last Modified On : Tue Jul 25 14:15:47 2017
     13// Update Count     : 54
    1414//
    1515
     
    298298        if ( result->isVoid() ) {
    299299                os << "nothing";
     300        } else {
     301                result->print( os, indent+2 );
     302        } // if
     303        os << std::endl;
     304        Expression::print( os, indent );
     305}
     306
     307VirtualCastExpr::VirtualCastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) {
     308        set_result(toType);
     309}
     310
     311VirtualCastExpr::VirtualCastExpr( const VirtualCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ) {
     312}
     313
     314VirtualCastExpr::~VirtualCastExpr() {
     315        delete arg;
     316}
     317
     318void VirtualCastExpr::print( std::ostream &os, int indent ) const {
     319        os << "Virtual Cast of:" << std::endl << std::string( indent+2, ' ' );
     320        arg->print(os, indent+2);
     321        os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl;
     322        os << std::string( indent+2, ' ' );
     323        if ( ! result ) {
     324                os << "unknown";
    300325        } else {
    301326                result->print( os, indent+2 );
  • src/SynTree/Expression.h

    r4d4e5de rfcd17b2f  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:53:16 2017
    13 // Update Count     : 42
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Jul 24 16:27:00 2017
     13// Update Count     : 43
    1414//
    1515
     
    7979class ApplicationExpr : public Expression {
    8080  public:
    81         ApplicationExpr( Expression * function );
     81        ApplicationExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() );
    8282        ApplicationExpr( const ApplicationExpr & other );
    8383        virtual ~ApplicationExpr();
     
    194194
    195195        Expression * get_arg() const { return arg; }
    196         void set_arg(Expression * newValue ) { arg = newValue; }
     196        void set_arg( Expression * newValue ) { arg = newValue; }
    197197
    198198        virtual CastExpr * clone() const { return new CastExpr( * this ); }
     199        virtual void accept( Visitor & v ) { v.visit( this ); }
     200        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     201        virtual void print( std::ostream & os, int indent = 0 ) const;
     202  private:
     203        Expression * arg;
     204};
     205
     206/// VirtualCastExpr repersents a virtual dynamic cast, e.g. (virtual exception)e
     207class VirtualCastExpr : public Expression {
     208  public:
     209        VirtualCastExpr( Expression * arg, Type * toType );
     210        VirtualCastExpr( const VirtualCastExpr & other );
     211        virtual ~VirtualCastExpr();
     212
     213        Expression * get_arg() const { return arg; }
     214        void set_arg( Expression * newValue ) { arg = newValue; }
     215
     216        virtual VirtualCastExpr * clone() const { return new VirtualCastExpr( * this ); }
    199217        virtual void accept( Visitor & v ) { v.visit( this ); }
    200218        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
  • src/SynTree/Mutator.cc

    r4d4e5de rfcd17b2f  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu Jun 22 13:43:00 2017
    13 // Update Count     : 24
     12// Last Modified On : Mon Jul 24 16:32:00 2017
     13// Update Count     : 25
    1414//
    1515
     
    235235}
    236236
     237Expression *Mutator::mutate( VirtualCastExpr *castExpr ) {
     238        castExpr->set_env( maybeMutate( castExpr->get_env(), *this ) );
     239        castExpr->set_result( maybeMutate( castExpr->get_result(), *this ) );
     240        castExpr->set_arg( maybeMutate( castExpr->get_arg(), *this ) );
     241        return castExpr;
     242}
     243
    237244Expression *Mutator::mutate( UntypedMemberExpr *memberExpr ) {
    238245        memberExpr->set_env( maybeMutate( memberExpr->get_env(), *this ) );
  • src/SynTree/Mutator.h

    r4d4e5de rfcd17b2f  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:51:30 2017
    13 // Update Count     : 15
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Jul 24 16:31:00 2017
     13// Update Count     : 16
    1414//
    1515#include <cassert>
     
    5959        virtual Expression* mutate( LabelAddressExpr *labAddressExpr );
    6060        virtual Expression* mutate( CastExpr *castExpr );
     61        virtual Expression* mutate( VirtualCastExpr *castExpr );
    6162        virtual Expression* mutate( UntypedMemberExpr *memberExpr );
    6263        virtual Expression* mutate( MemberExpr *memberExpr );
  • src/SynTree/SynTree.h

    r4d4e5de rfcd17b2f  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:51:46 2017
    13 // Update Count     : 10
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Jul 24 16:54:00 2017
     13// Update Count     : 11
    1414//
    1515
     
    6666class LabelAddressExpr;
    6767class CastExpr;
     68class VirtualCastExpr;
    6869class MemberExpr;
    6970class UntypedMemberExpr;
  • src/SynTree/Visitor.cc

    r4d4e5de rfcd17b2f  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu Jun 22 13:41:00 2017
    13 // Update Count     : 26
     12// Last Modified On : Mon Jul 24 16:30:00 2017
     13// Update Count     : 27
    1414//
    1515
     
    192192}
    193193
     194void Visitor::visit( VirtualCastExpr *castExpr ) {
     195        maybeAccept( castExpr->get_result(), *this );
     196        maybeAccept( castExpr->get_arg(), *this );
     197}
     198
    194199void Visitor::visit( UntypedMemberExpr *memberExpr ) {
    195200        maybeAccept( memberExpr->get_result(), *this );
  • src/SynTree/Visitor.h

    r4d4e5de rfcd17b2f  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:54:04 2017
    13 // Update Count     : 12
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Jul 24 16:28:00 2017
     13// Update Count     : 13
    1414//
    1515
     
    6060        virtual void visit( NameExpr *nameExpr );
    6161        virtual void visit( CastExpr *castExpr );
     62        virtual void visit( VirtualCastExpr *castExpr );
    6263        virtual void visit( AddressExpr *addressExpr );
    6364        virtual void visit( LabelAddressExpr *labAddressExpr );
Note: See TracChangeset for help on using the changeset viewer.