Ignore:
Timestamp:
Aug 16, 2016, 3:20:06 PM (9 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
1f6d4624
Parents:
950f7a7 (diff), 7880579 (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/SynTree/Expression.h

    r950f7a7 r7527e63  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jul  4 14:45:32 2016
    13 // Update Count     : 23
     12// Last Modified On : Sat Aug  6 08:52:53 2016
     13// Update Count     : 35
    1414//
    1515
     
    1818
    1919#include <map>
     20#include <memory>
    2021#include "SynTree.h"
    2122#include "Visitor.h"
     
    2728class Expression {
    2829  public:
    29         Expression(Expression *_aname = 0 );
     30        Expression( Expression *_aname = nullptr );
    3031        Expression( const Expression &other );
    3132        virtual ~Expression();
     
    6970typedef std::map< UniqueId, ParamEntry > InferredParams;
    7071
    71 /// ApplicationExpr represents the application of a function to a set of parameters.  This is the
    72 /// result of running an UntypedExpr through the expression analyzer.
     72/// ApplicationExpr represents the application of a function to a set of parameters.  This is the result of running an
     73/// UntypedExpr through the expression analyzer.
    7374class ApplicationExpr : public Expression {
    7475  public:
     
    9293};
    9394
    94 /// UntypedExpr represents the application of a function to a set of parameters, but where the
    95 /// particular overload for the function name has not yet been determined.  Most operators are
    96 /// converted into functional form automatically, to permit operator overloading.
     95/// UntypedExpr represents the application of a function to a set of parameters, but where the particular overload for
     96/// the function name has not yet been determined.  Most operators are converted into functional form automatically, to
     97/// permit operator overloading.
    9798class UntypedExpr : public Expression {
    9899  public:
    99         UntypedExpr( Expression *function, Expression *_aname = 0 );
     100        UntypedExpr( Expression *function, Expression *_aname = nullptr );
    100101        UntypedExpr( const UntypedExpr &other );
    101         UntypedExpr( Expression *function, std::list<Expression *> &args, Expression *_aname = 0 );
     102        UntypedExpr( Expression *function, std::list<Expression *> &args, Expression *_aname = nullptr );
    102103        virtual ~UntypedExpr();
    103104
     
    123124class NameExpr : public Expression {
    124125  public:
    125         NameExpr( std::string name, Expression *_aname = 0 );
     126        NameExpr( std::string name, Expression *_aname = nullptr );
    126127        NameExpr( const NameExpr &other );
    127128        virtual ~NameExpr();
     
    144145class AddressExpr : public Expression {
    145146  public:
    146         AddressExpr( Expression *arg, Expression *_aname = 0 );
     147        AddressExpr( Expression *arg, Expression *_aname = nullptr );
    147148        AddressExpr( const AddressExpr &other );
    148149        virtual ~AddressExpr();
     
    180181class CastExpr : public Expression {
    181182  public:
    182         CastExpr( Expression *arg, Expression *_aname = 0 );
    183         CastExpr( Expression *arg, Type *toType, Expression *_aname = 0 );
     183        CastExpr( Expression *arg, Expression *_aname = nullptr );
     184        CastExpr( Expression *arg, Type *toType, Expression *_aname = nullptr );
    184185        CastExpr( const CastExpr &other );
    185186        virtual ~CastExpr();
     
    199200class UntypedMemberExpr : public Expression {
    200201  public:
    201         UntypedMemberExpr( std::string member, Expression *aggregate, Expression *_aname = 0 );
     202        UntypedMemberExpr( std::string member, Expression *aggregate, Expression *_aname = nullptr );
    202203        UntypedMemberExpr( const UntypedMemberExpr &other );
    203204        virtual ~UntypedMemberExpr();
     
    220221class MemberExpr : public Expression {
    221222  public:
    222         MemberExpr( DeclarationWithType *member, Expression *aggregate, Expression *_aname = 0 );
     223        MemberExpr( DeclarationWithType *member, Expression *aggregate, Expression *_aname = nullptr );
    223224        MemberExpr( const MemberExpr &other );
    224225        virtual ~MemberExpr();
     
    241242class VariableExpr : public Expression {
    242243  public:
    243         VariableExpr( DeclarationWithType *var, Expression *_aname = 0 );
     244        VariableExpr( DeclarationWithType *var, Expression *_aname = nullptr );
    244245        VariableExpr( const VariableExpr &other );
    245246        virtual ~VariableExpr();
     
    259260class ConstantExpr : public Expression {
    260261  public:
    261         ConstantExpr( Constant constant, Expression *_aname = 0 );
     262        ConstantExpr( Constant constant, Expression *_aname = nullptr );
    262263        ConstantExpr( const ConstantExpr &other );
    263264        virtual ~ConstantExpr();
     
    277278class SizeofExpr : public Expression {
    278279  public:
    279         SizeofExpr( Expression *expr, Expression *_aname = 0 );
     280        SizeofExpr( Expression *expr, Expression *_aname = nullptr );
    280281        SizeofExpr( const SizeofExpr &other );
    281         SizeofExpr( Type *type, Expression *_aname = 0 );
     282        SizeofExpr( Type *type, Expression *_aname = nullptr );
    282283        virtual ~SizeofExpr();
    283284
     
    302303class AlignofExpr : public Expression {
    303304  public:
    304         AlignofExpr( Expression *expr, Expression *_aname = 0 );
     305        AlignofExpr( Expression *expr, Expression *_aname = nullptr );
    305306        AlignofExpr( const AlignofExpr &other );
    306         AlignofExpr( Type *type, Expression *_aname = 0 );
     307        AlignofExpr( Type *type, Expression *_aname = nullptr );
    307308        virtual ~AlignofExpr();
    308309
     
    327328class UntypedOffsetofExpr : public Expression {
    328329  public:
    329         UntypedOffsetofExpr( Type *type, const std::string &member, Expression *_aname = 0 );
     330        UntypedOffsetofExpr( Type *type, const std::string &member, Expression *_aname = nullptr );
    330331        UntypedOffsetofExpr( const UntypedOffsetofExpr &other );
    331332        virtual ~UntypedOffsetofExpr();
     
    348349class OffsetofExpr : public Expression {
    349350  public:
    350         OffsetofExpr( Type *type, DeclarationWithType *member, Expression *_aname = 0 );
     351        OffsetofExpr( Type *type, DeclarationWithType *member, Expression *_aname = nullptr );
    351352        OffsetofExpr( const OffsetofExpr &other );
    352353        virtual ~OffsetofExpr();
     
    389390class AttrExpr : public Expression {
    390391  public:
    391         AttrExpr(Expression *attr, Expression *expr, Expression *_aname = 0 );
     392        AttrExpr(Expression *attr, Expression *expr, Expression *_aname = nullptr );
    392393        AttrExpr( const AttrExpr &other );
    393         AttrExpr( Expression *attr, Type *type, Expression *_aname = 0 );
     394        AttrExpr( Expression *attr, Type *type, Expression *_aname = nullptr );
    394395        virtual ~AttrExpr();
    395396
     
    417418class LogicalExpr : public Expression {
    418419  public:
    419         LogicalExpr( Expression *arg1, Expression *arg2, bool andp = true, Expression *_aname = 0 );
     420        LogicalExpr( Expression *arg1, Expression *arg2, bool andp = true, Expression *_aname = nullptr );
    420421        LogicalExpr( const LogicalExpr &other );
    421422        virtual ~LogicalExpr();
     
    440441class ConditionalExpr : public Expression {
    441442  public:
    442         ConditionalExpr( Expression *arg1, Expression *arg2, Expression *arg3, Expression *_aname = 0 );
     443        ConditionalExpr( Expression *arg1, Expression *arg2, Expression *arg3, Expression *_aname = nullptr );
    443444        ConditionalExpr( const ConditionalExpr &other );
    444445        virtual ~ConditionalExpr();
     
    464465class CommaExpr : public Expression {
    465466  public:
    466         CommaExpr( Expression *arg1, Expression *arg2, Expression *_aname = 0 );
     467        CommaExpr( Expression *arg1, Expression *arg2, Expression *_aname = nullptr );
    467468        CommaExpr( const CommaExpr &other );
    468469        virtual ~CommaExpr();
     
    485486class TupleExpr : public Expression {
    486487  public:
    487         TupleExpr( Expression *_aname = 0 );
     488        TupleExpr( Expression *_aname = nullptr );
    488489        TupleExpr( const TupleExpr &other );
    489490        virtual ~TupleExpr();
     
    503504class SolvedTupleExpr : public Expression {
    504505  public:
    505         SolvedTupleExpr( Expression *_aname = 0 ) : Expression( _aname ) {}
    506         SolvedTupleExpr( std::list<Expression *> &, Expression *_aname = 0 );
     506        SolvedTupleExpr( Expression *_aname = nullptr ) : Expression( _aname ) {}
     507        SolvedTupleExpr( std::list<Expression *> &, Expression *_aname = nullptr );
    507508        SolvedTupleExpr( const SolvedTupleExpr &other );
    508509        virtual ~SolvedTupleExpr() {}
     
    597598class UntypedValofExpr : public Expression {
    598599  public:
    599         UntypedValofExpr( Statement *_body, Expression *_aname = 0 ) : Expression( _aname ), body ( _body ) {}
     600        UntypedValofExpr( Statement *_body, Expression *_aname = nullptr ) : Expression( _aname ), body ( _body ) {}
    600601        UntypedValofExpr( const UntypedValofExpr & other );
    601602        virtual ~UntypedValofExpr();
     
    632633        Type * type;
    633634        Initializer * initializer;
     635};
     636
     637class RangeExpr : public Expression {
     638  public:
     639        RangeExpr( Expression *low, Expression *high );
     640        RangeExpr( const RangeExpr &other );
     641
     642        Expression * get_low() const { return low; }
     643        Expression * get_high() const { return high; }
     644        RangeExpr * set_low( Expression *low ) { RangeExpr::low = low; return this; }
     645        RangeExpr * set_high( Expression *high ) { RangeExpr::high = high; return this; }
     646
     647        virtual RangeExpr *clone() const { return new RangeExpr( *this ); }
     648        virtual void accept( Visitor &v ) { v.visit( this ); }
     649        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     650        virtual void print( std::ostream &os, int indent = 0 ) const;
     651  private:
     652        Expression *low, *high;
    634653};
    635654
Note: See TracChangeset for help on using the changeset viewer.