Changeset 0f79853 for src/SynTree


Ignore:
Timestamp:
Jun 7, 2018, 9:55:28 AM (7 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, with_gc
Children:
61d9b4b
Parents:
2a6c115
Message:

Remove conversion cost for default arguments

Location:
src/SynTree
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    r2a6c115 r0f79853  
    746746        os << std::endl << indent+1 << "... deleted by: ";
    747747        deleteStmt->print( os, indent+1 );
     748}
     749
     750
     751DefaultArgExpr::DefaultArgExpr( Expression * expr ) : expr( expr ) {
     752        assert( expr->result );
     753        result = expr->result->clone();
     754}
     755DefaultArgExpr::DefaultArgExpr( const DefaultArgExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ) {}
     756DefaultArgExpr::~DefaultArgExpr() {
     757        delete expr;
     758}
     759
     760void DefaultArgExpr::print( std::ostream & os, Indenter indent ) const {
     761        os << "Default Argument Expression" << std::endl << indent+1;
     762        expr->print( os, indent+1 );
    748763}
    749764
  • src/SynTree/Expression.h

    r2a6c115 r0f79853  
    865865};
    866866
     867/// expression wrapping the use of a default argument - should never make it past the resolver.
     868class DefaultArgExpr : public Expression {
     869public:
     870        Expression * expr;
     871
     872        DefaultArgExpr( Expression * expr );
     873        DefaultArgExpr( const DefaultArgExpr & other );
     874        ~DefaultArgExpr();
     875
     876        virtual DefaultArgExpr * clone() const { return new DefaultArgExpr( * this ); }
     877        virtual void accept( Visitor & v ) { v.visit( this ); }
     878        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     879        virtual void print( std::ostream & os, Indenter indent = {} ) const;
     880};
     881
    867882/// C11 _Generic expression
    868883class GenericExpr : public Expression {
  • src/SynTree/Mutator.h

    r2a6c115 r0f79853  
    9393        virtual Expression * mutate( InitExpr  * initExpr ) = 0;
    9494        virtual Expression * mutate( DeletedExpr * delExpr ) = 0;
     95        virtual Expression * mutate( DefaultArgExpr * argExpr ) = 0;
    9596        virtual Expression * mutate( GenericExpr * genExpr ) = 0;
    9697
  • src/SynTree/SynTree.h

    r2a6c115 r0f79853  
    101101class InitExpr;
    102102class DeletedExpr;
     103class DefaultArgExpr;
    103104class GenericExpr;
    104105
  • src/SynTree/Visitor.h

    r2a6c115 r0f79853  
    9595        virtual void visit( InitExpr *  initExpr ) = 0;
    9696        virtual void visit( DeletedExpr * delExpr ) = 0;
     97        virtual void visit( DefaultArgExpr * argExpr ) = 0;
    9798        virtual void visit( GenericExpr * genExpr ) = 0;
    9899
Note: See TracChangeset for help on using the changeset viewer.