Ignore:
Timestamp:
Jan 7, 2021, 2:55:57 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
58fe85a
Parents:
bdfc032 (diff), 44e37ef (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' into dkobets-vector

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.h

    rbdfc032 reef8dfb  
    163163};
    164164
     165/// VariableExpr represents an expression that simply refers to the value of a named variable.
     166/// Does not take ownership of var.
     167class VariableExpr : public Expression {
     168  public:
     169        DeclarationWithType * var;
     170
     171        VariableExpr();
     172        VariableExpr( DeclarationWithType * var );
     173        VariableExpr( const VariableExpr & other );
     174        virtual ~VariableExpr();
     175
     176        bool get_lvalue() const final;
     177
     178        DeclarationWithType * get_var() const { return var; }
     179        void set_var( DeclarationWithType * newValue ) { var = newValue; }
     180
     181        static VariableExpr * functionPointer( FunctionDecl * decl );
     182
     183        virtual VariableExpr * clone() const override { return new VariableExpr( * this ); }
     184        virtual void accept( Visitor & v ) override { v.visit( this ); }
     185        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     186        virtual Expression * acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     187        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
     188};
     189
    165190// The following classes are used to represent expression types that cannot be converted into
    166191// function-call format.
     
    206231  public:
    207232        Expression * arg;
    208         bool isGenerated = true; // cast generated implicitly by code generation or explicit in program
     233
     234        // Inidicates cast is introduced by the CFA type system.
     235        // true for casts that the resolver introduces to force a return type
     236        // false for casts from user code
     237        // false for casts from desugaring advanced CFA features into simpler CFA
     238        // example
     239        //   int * p;     // declaration
     240        //   (float *) p; // use, with subject cast
     241        // subject cast isGenerated means we are considering an interpretation with a type mismatch
     242        // subject cast not isGenerated means someone in charge wants it that way
     243        bool isGenerated = true;
    209244
    210245        CastExpr( Expression * arg, bool isGenerated = true );
     
    238273
    239274        KeywordCastExpr( Expression * arg, AggregateDecl::Aggregate target );
     275        KeywordCastExpr( Expression * arg, AggregateDecl::Aggregate target, const Concrete & concrete_target );
    240276        KeywordCastExpr( const KeywordCastExpr & other );
    241277        virtual ~KeywordCastExpr();
     
    312348
    313349        virtual MemberExpr * clone() const override { return new MemberExpr( * this ); }
    314         virtual void accept( Visitor & v ) override { v.visit( this ); }
    315         virtual void accept( Visitor & v ) const override { v.visit( this ); }
    316         virtual Expression * acceptMutator( Mutator & m ) override { return m.mutate( this ); }
    317         virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    318 };
    319 
    320 /// VariableExpr represents an expression that simply refers to the value of a named variable.
    321 /// Does not take ownership of var.
    322 class VariableExpr : public Expression {
    323   public:
    324         DeclarationWithType * var;
    325 
    326         VariableExpr();
    327         VariableExpr( DeclarationWithType * var );
    328         VariableExpr( const VariableExpr & other );
    329         virtual ~VariableExpr();
    330 
    331         bool get_lvalue() const final;
    332 
    333         DeclarationWithType * get_var() const { return var; }
    334         void set_var( DeclarationWithType * newValue ) { var = newValue; }
    335 
    336         static VariableExpr * functionPointer( FunctionDecl * decl );
    337 
    338         virtual VariableExpr * clone() const override { return new VariableExpr( * this ); }
    339350        virtual void accept( Visitor & v ) override { v.visit( this ); }
    340351        virtual void accept( Visitor & v ) const override { v.visit( this ); }
Note: See TracChangeset for help on using the changeset viewer.