Changeset 330d933 for src/SynTree


Ignore:
Timestamp:
Aug 25, 2019, 8:48:51 AM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
2aab69b, 5a43ab8
Parents:
f9bf142 (diff), bbb1b35 (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:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/AddressExpr.cc

    rf9bf142 r330d933  
    4242AddressExpr::AddressExpr( Expression *arg ) : Expression(), arg( arg ) {
    4343        if ( arg->result ) {
    44                 if ( arg->result->get_lvalue() ) {
     44                if ( arg->get_lvalue() ) {
    4545                        // lvalue, retains all layers of reference and gains a pointer inside the references
    4646                        set_result( addrType( arg->result ) );
  • src/SynTree/ApplicationExpr.cc

    rf9bf142 r330d933  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue Apr 26 12:41:06 2016
    13 // Update Count     : 4
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Aug 12 14:28:00 2019
     13// Update Count     : 5
    1414//
    1515
     
    7676}
    7777
     78bool ApplicationExpr::get_lvalue() const {
     79        return result->get_lvalue();
     80}
     81
    7882void ApplicationExpr::print( std::ostream &os, Indenter indent ) const {
    7983        os << "Application of" << std::endl << indent+1;
  • src/SynTree/BasicType.cc

    rf9bf142 r330d933  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jan 31 21:37:36 2019
    13 // Update Count     : 12
     12// Last Modified On : Sun Aug  4 21:07:44 2019
     13// Update Count     : 13
    1414//
    1515
     
    3131bool BasicType::isInteger() const {
    3232        return kind <= UnsignedInt128;
    33 #if 0
    34         switch ( kind ) {
    35           case Bool:
    36           case Char:
    37           case SignedChar:
    38           case UnsignedChar:
    39           case ShortSignedInt:
    40           case ShortUnsignedInt:
    41           case SignedInt:
    42           case UnsignedInt:
    43           case LongSignedInt:
    44           case LongUnsignedInt:
    45           case LongLongSignedInt:
    46           case LongLongUnsignedInt:
    47           case SignedInt128:
    48           case UnsignedInt128:
    49                 return true;
    50           case Float:
    51           case Double:
    52           case LongDouble:
    53           case FloatComplex:
    54           case DoubleComplex:
    55           case LongDoubleComplex:
    56           case FloatImaginary:
    57           case DoubleImaginary:
    58           case LongDoubleImaginary:
    59           case Float80:
    60           case Float128:
    61                 return false;
    62           case NUMBER_OF_BASIC_TYPES:
    63                 assert( false );
    64         } // switch
    65         assert( false );
    66         return false;
    67 #endif
    6833}
    6934
  • src/SynTree/CommaExpr.cc

    rf9bf142 r330d933  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Mon May 02 15:19:44 2016
    13 // Update Count     : 1
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Arg 12 16:11:00 2016
     13// Update Count     : 2
    1414//
    1515
     
    3939}
    4040
     41bool CommaExpr::get_lvalue() const {
     42        // xxx - as above, shouldn't be an lvalue but that information is used anyways.
     43        return result->get_lvalue();
     44}
     45
    4146void CommaExpr::print( std::ostream &os, Indenter indent ) const {
    4247        os << "Comma Expression:" << std::endl;
  • src/SynTree/Expression.cc

    rf9bf142 r330d933  
    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 : Thu Jul 25 22:21:48 2019
    13 // Update Count     : 61
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Aug 15 13:43:00 2019
     13// Update Count     : 64
    1414//
    1515
     
    6363}
    6464
     65bool Expression::get_lvalue() const {
     66        assert( !result->get_lvalue() );
     67        return false;
     68}
     69
    6570void Expression::print( std::ostream & os, Indenter indent ) const {
    6671        printInferParams( inferParams, os, indent+1, 0 );
     
    134139}
    135140
     141bool VariableExpr::get_lvalue() const {
     142        return result->get_lvalue();
     143}
     144
    136145VariableExpr * VariableExpr::functionPointer( FunctionDecl * func ) {
    137146        VariableExpr * funcExpr = new VariableExpr( func );
     
    265274CastExpr::~CastExpr() {
    266275        delete arg;
     276}
     277
     278bool CastExpr::get_lvalue() const {
     279        return result->get_lvalue();
    267280}
    268281
     
    376389        // don't delete the member declaration, since it points somewhere else in the tree
    377390        delete aggregate;
     391}
     392
     393bool MemberExpr::get_lvalue() const {
     394        assert( result->get_lvalue() );
     395        return true;
    378396}
    379397
     
    428446}
    429447
     448bool UntypedExpr::get_lvalue() const {
     449        return result->get_lvalue();
     450}
    430451
    431452void UntypedExpr::print( std::ostream & os, Indenter indent ) const {
     
    486507        delete arg2;
    487508        delete arg3;
     509}
     510
     511bool ConditionalExpr::get_lvalue() const {
     512        return result->get_lvalue();
    488513}
    489514
     
    544569}
    545570
     571bool ConstructorExpr::get_lvalue() const {
     572        return result->get_lvalue();
     573}
     574
    546575void ConstructorExpr::print( std::ostream & os, Indenter indent ) const {
    547576        os <<  "Constructor Expression: " << std::endl << indent+1;
     
    561590CompoundLiteralExpr::~CompoundLiteralExpr() {
    562591        delete initializer;
     592}
     593
     594bool CompoundLiteralExpr::get_lvalue() const {
     595        assert( result->get_lvalue() );
     596        return true;
    563597}
    564598
     
    612646                result = new VoidType( Type::Qualifiers() );
    613647        }
     648}
     649bool StmtExpr::get_lvalue() const {
     650        return result->get_lvalue();
    614651}
    615652void StmtExpr::print( std::ostream & os, Indenter indent ) const {
  • src/SynTree/Expression.h

    rf9bf142 r330d933  
    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 : Thu Jul 25 22:21:44 2019
    13 // Update Count     : 50
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Aug 15 13:46:00 2019
     13// Update Count     : 54
    1414//
    1515
     
    7171        const Type * get_result() const { return result; }
    7272        void set_result( Type * newValue ) { result = newValue; }
     73        virtual bool get_lvalue() const;
    7374
    7475        TypeSubstitution * get_env() const { return env; }
     
    9899        virtual ~ApplicationExpr();
    99100
     101        bool get_lvalue() const final;
     102
    100103        Expression * get_function() const { return function; }
    101104        void set_function( Expression * newValue ) { function = newValue; }
     
    120123        UntypedExpr( const UntypedExpr & other );
    121124        virtual ~UntypedExpr();
     125
     126        bool get_lvalue() const final;
    122127
    123128        Expression * get_function() const { return function; }
     
    208213        virtual ~CastExpr();
    209214
     215        bool get_lvalue() const final;
     216
    210217        Expression * get_arg() const { return arg; }
    211218        void set_arg( Expression * newValue ) { arg = newValue; }
     
    291298        virtual ~MemberExpr();
    292299
     300        bool get_lvalue() const final;
     301
    293302        DeclarationWithType * get_member() const { return member; }
    294303        void set_member( DeclarationWithType * newValue ) { member = newValue; }
     
    313322        VariableExpr( const VariableExpr & other );
    314323        virtual ~VariableExpr();
     324
     325        bool get_lvalue() const final;
    315326
    316327        DeclarationWithType * get_var() const { return var; }
     
    500511        virtual ~ConditionalExpr();
    501512
     513        bool get_lvalue() const final;
     514
    502515        Expression * get_arg1() const { return arg1; }
    503516        void set_arg1( Expression * newValue ) { arg1 = newValue; }
     
    524537        virtual ~CommaExpr();
    525538
     539        bool get_lvalue() const final;
     540
    526541        Expression * get_arg1() const { return arg1; }
    527542        void set_arg1( Expression * newValue ) { arg1 = newValue; }
     
    610625        ~ConstructorExpr();
    611626
     627        bool get_lvalue() const final;
     628
    612629        Expression * get_callExpr() const { return callExpr; }
    613630        void set_callExpr( Expression * newValue ) { callExpr = newValue; }
     
    628645        CompoundLiteralExpr( const CompoundLiteralExpr & other );
    629646        virtual ~CompoundLiteralExpr();
     647
     648        bool get_lvalue() const final;
    630649
    631650        Initializer * get_initializer() const { return initializer; }
     
    686705        virtual ~TupleExpr();
    687706
     707        bool get_lvalue() const final;
     708
    688709        std::list<Expression*>& get_exprs() { return exprs; }
    689710
     
    704725        TupleIndexExpr( const TupleIndexExpr & other );
    705726        virtual ~TupleIndexExpr();
     727
     728        bool get_lvalue() const final;
    706729
    707730        Expression * get_tuple() const { return tuple; }
     
    753776        StmtExpr( const StmtExpr & other );
    754777        virtual ~StmtExpr();
     778
     779        bool get_lvalue() const final;
    755780
    756781        CompoundStmt * get_statements() const { return statements; }
  • src/SynTree/TupleExpr.cc

    rf9bf142 r330d933  
    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 : Fri Mar 17 09:42:29 2017
    13 // Update Count     : 3
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Aug 14 14:34:00 2019
     13// Update Count     : 5
    1414//
    1515
     
    5757}
    5858
     59bool TupleExpr::get_lvalue() const {
     60        return result->get_lvalue();
     61}
     62
    5963void TupleExpr::print( std::ostream &os, Indenter indent ) const {
    6064        os << "Tuple:" << std::endl;
     
    7680TupleIndexExpr::~TupleIndexExpr() {
    7781        delete tuple;
     82}
     83
     84bool TupleIndexExpr::get_lvalue() const {
     85        assert( result->get_lvalue() );
     86        return true;
    7887}
    7988
  • src/SynTree/Type.cc

    rf9bf142 r330d933  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jul 12 15:48:00 2019
    13 // Update Count     : 44
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sun Aug  4 21:05:07 2019
     13// Update Count     : 45
    1414//
    1515#include "Type.h"
     
    2424using namespace std;
    2525
    26 const char *BasicType::typeNames[] = {
    27 #if 0
    28         "_Bool",
    29         "char",
    30         "signed char",
    31         "unsigned char",
    32         "signed short int",
    33         "unsigned short int",
    34         "signed int",
    35         "unsigned int",
    36         "signed long int",
    37         "unsigned long int",
    38         "signed long long int",
    39         "unsigned long long int",
    40         "float",
    41         "double",
    42         "long double",
    43         "float _Complex",
    44         "double _Complex",
    45         "long double _Complex",
    46         "float _Imaginary",
    47         "double _Imaginary",
    48         "long double _Imaginary",
    49         "__int128",
    50         "unsigned __int128",
    51         "__float80",
    52         "__float128",
    53         "_Float16",
    54         "_Float32",
    55         "_Float32x",
    56         "_Float64",
    57         "_Float64x",
    58         "_Float128",
    59         "_Float128x",
    60         "_Float16 _Complex",
    61         "_Float32 _Complex",
    62         "_Float32x _Complex",
    63         "_Float64 _Complex",
    64         "_Float64x _Complex",
    65         "_Float128 _Complex",
    66         "_Float128x _Complex",
    67 #endif
     26const char * BasicType::typeNames[] = {
    6827        "_Bool",
    6928        "char",
     
    10766};
    10867static_assert(
    109         sizeof(BasicType::typeNames)/sizeof(BasicType::typeNames[0]) == BasicType::NUMBER_OF_BASIC_TYPES,
     68        sizeof(BasicType::typeNames) / sizeof(BasicType::typeNames[0]) == BasicType::NUMBER_OF_BASIC_TYPES,
    11069        "Each basic type name should have a corresponding kind enum value"
    11170);
     
    152111TypeSubstitution Type::genericSubstitution() const { assertf( false, "Non-aggregate type: %s", toCString( this ) ); }
    153112
    154 void Type::print( std::ostream &os, Indenter indent ) const {
     113void Type::print( std::ostream & os, Indenter indent ) const {
    155114        if ( ! forall.empty() ) {
    156115                os << "forall" << std::endl;
  • src/SynTree/module.mk

    rf9bf142 r330d933  
    4949      SynTree/TypeSubstitution.cc \
    5050      SynTree/Attribute.cc \
    51       SynTree/DeclReplacer.cc
     51      SynTree/DeclReplacer.cc \
     52      SynTree/TopLvalue.cc
    5253
    5354SRC += $(SRC_SYNTREE)
Note: See TracChangeset for help on using the changeset viewer.