Changeset b4f8808 for src/SynTree


Ignore:
Timestamp:
Sep 26, 2019, 1:25:49 PM (6 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
70b4ea20, ea2074e
Parents:
849720f
Message:

Removed lvalue from types in the old ast.

Location:
src/SynTree
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/AddressExpr.cc

    r849720f rb4f8808  
    5353                        } // if
    5454                }
    55                 // result of & is never an lvalue
    56                 get_result()->set_lvalue( false );
    5755        }
    5856}
  • src/SynTree/ArrayType.cc

    r849720f rb4f8808  
    2626ArrayType::ArrayType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes )
    2727        : Type( tq, attributes ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic ) {
    28         base->set_lvalue( false );
    2928}
    3029
  • src/SynTree/CommaExpr.cc

    r849720f rb4f8808  
    2323CommaExpr::CommaExpr( Expression *arg1, Expression *arg2 )
    2424                : Expression(), arg1( arg1 ), arg2( arg2 ) {
    25         // xxx - result of a comma expression is never an lvalue, so should set lvalue
    26         // to false on all result types. Actually doing this causes some strange things
    27         // to happen in later passes (particularly, Specialize, Lvalue, and Box). This needs to be looked into.
    2825        set_result( maybeClone( arg2->get_result() ) );
    29         // get_type->set_isLvalue( false );
    3026}
    3127
     
    4137bool CommaExpr::get_lvalue() const {
    4238        // This is wrong by C, but the current implementation uses it.
     39        // (ex: Specialize, Lvalue and Box)
    4340        return arg2->get_lvalue();
    4441}
  • src/SynTree/Expression.cc

    r849720f rb4f8808  
    115115        assert( var->get_type() );
    116116        Type * type = var->get_type()->clone();
    117         type->set_lvalue( true );
    118117
    119118        // xxx - doesn't quite work yet - get different alternatives with the same cost
     
    125124        //      long long int value;
    126125        //      if ( decl->valueOf( var, value ) ) {
    127         //              type->set_lvalue( false );
     126        //              type->set_lvalue( false ); // Would have to move to get_lvalue.
    128127        //      }
    129128        // }
     
    384383        sub.apply( res );
    385384        result = res;
    386         result->set_lvalue( true );
    387385        result->get_qualifiers() |= aggregate->result->get_qualifiers();
    388386}
     
    433431                        // if references are still allowed in the AST, dereference returns a reference
    434432                        ret->set_result( new ReferenceType( Type::Qualifiers(), ret->get_result() ) );
    435                 } else {
    436                         // references have been removed, in which case dereference returns an lvalue of the base type.
    437                         ret->result->set_lvalue( true );
    438433                }
    439434        }
     
    591586CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : initializer( initializer ) {
    592587        assert( type && initializer );
    593         type->set_lvalue( true );
    594588        set_result( type );
    595589}
  • src/SynTree/TupleExpr.cc

    r849720f rb4f8808  
    7171        assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested index %d in expr %s", type->size(), index, toString( tuple ).c_str() );
    7272        set_result( (*std::next( type->get_types().begin(), index ))->clone() );
    73         // like MemberExpr, TupleIndexExpr is always an lvalue
    74         get_result()->set_lvalue( true );
    7573}
    7674
  • src/SynTree/Type.cc

    r849720f rb4f8808  
    8585const char * Type::FuncSpecifiersNames[] = { "inline", "_Noreturn", "fortran" };
    8686const char * Type::StorageClassesNames[] = { "extern", "static", "auto", "register", "_Thread_local" };
    87 const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", "lvalue", "mutex", "_Atomic" };
     87const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", "mutex", "_Atomic" };
    8888
    8989Type * Type::stripDeclarator() {
  • src/SynTree/Type.h

    r849720f rb4f8808  
    102102        }; // StorageClasses
    103103
    104         enum { Const = 1 << 0, Restrict = 1 << 1, Volatile = 1 << 2, Lvalue = 1 << 3, Mutex = 1 << 4, Atomic = 1 << 5, NumTypeQualifier = 6 };
     104        enum { Const = 1 << 0, Restrict = 1 << 1, Volatile = 1 << 2, Mutex = 1 << 3, Atomic = 1 << 4, NumTypeQualifier = 5 };
    105105        static const char * QualifiersNames[];
    106106        union Qualifiers {
    107                 enum { Mask = ~(Restrict | Lvalue) };
     107                enum { Mask = ~Restrict };
    108108                unsigned int val;
    109109                struct {
     
    111111                        bool is_restrict : 1;
    112112                        bool is_volatile : 1;
    113                         bool is_lvalue : 1;
    114113                        bool is_mutex : 1;
    115114                        bool is_atomic : 1;
     
    153152        bool get_volatile() const { return tq.is_volatile; }
    154153        bool get_restrict() const { return tq.is_restrict; }
    155         bool get_lvalue() const { return tq.is_lvalue; }
    156154        bool get_mutex() const { return tq.is_mutex; }
    157155        bool get_atomic() const { return tq.is_atomic; }
     
    159157        void set_volatile( bool newValue ) { tq.is_volatile = newValue; }
    160158        void set_restrict( bool newValue ) { tq.is_restrict = newValue; }
    161         void set_lvalue( bool newValue ) { tq.is_lvalue = newValue; }
    162159        void set_mutex( bool newValue ) { tq.is_mutex = newValue; }
    163160        void set_atomic( bool newValue ) { tq.is_atomic = newValue; }
  • src/SynTree/module.mk

    r849720f rb4f8808  
    4949      SynTree/TypeSubstitution.cc \
    5050      SynTree/Attribute.cc \
    51       SynTree/DeclReplacer.cc \
    52       SynTree/TopLvalue.cc
     51      SynTree/DeclReplacer.cc
    5352
    5453SRC += $(SRC_SYNTREE)
Note: See TracChangeset for help on using the changeset viewer.