Changeset 7527e63 for src/SynTree


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

Location:
src/SynTree
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/AddStmtVisitor.cc

    r950f7a7 r7527e63  
    1010// Created On       : Wed Jun 22 12:11:17 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:49:59 2016
    13 // Update Count     : 12
     12// Last Modified On : Thu Aug  4 11:23:47 2016
     13// Update Count     : 16
    1414//
    1515
     
    7171
    7272void AddStmtVisitor::visit(SwitchStmt *switchStmt) {
    73         visitStatementList( switchStmt->get_branches() );
     73        visitStatementList( switchStmt->get_statements() );
    7474        maybeAccept( switchStmt->get_condition(), *this );
    7575}
  • src/SynTree/Declaration.cc

    r950f7a7 r7527e63  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Declaration.cc -- 
     7// Declaration.cc --
    88//
    99// Author           : Richard C. Bilson
     
    2020#include "Initializer.h"
    2121#include "Type.h"
     22#include "Attribute.h"
    2223#include "Common/utility.h"
    2324
  • src/SynTree/Declaration.h

    r950f7a7 r7527e63  
    6464class DeclarationWithType : public Declaration {
    6565  public:
    66         DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage );
     66        DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, const std::list< Attribute * > & attributes );
    6767        DeclarationWithType( const DeclarationWithType &other );
    6868        virtual ~DeclarationWithType();
     
    7575        int get_scopeLevel() const { return scopeLevel; }
    7676        void set_scopeLevel( int newValue ) { scopeLevel = newValue; }
     77
     78        std::list< Attribute * >& get_attributes() { return attributes; }
     79        const std::list< Attribute * >& get_attributes() const { return attributes; }
    7780
    7881        virtual DeclarationWithType *clone() const = 0;
     
    8790        // shadowed identifiers can be accessed
    8891        int scopeLevel = 0;
     92
     93        std::list< Attribute * > attributes;
    8994};
    9095
     
    9297        typedef DeclarationWithType Parent;
    9398  public:
    94         ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, bool isInline = false, bool isNoreturn = false );
     99        ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes = std::list< Attribute * >(), bool isInline = false, bool isNoreturn = false );
    95100        ObjectDecl( const ObjectDecl &other );
    96101        virtual ~ObjectDecl();
     
    131136        std::list< std::string >& get_oldIdents() { return oldIdents; }
    132137        std::list< Declaration* >& get_oldDecls() { return oldDecls; }
    133         std::list< Attribute * >& get_attributes() { return attributes; }
    134138
    135139        virtual FunctionDecl *clone() const { return new FunctionDecl( *this ); }
     
    143147        std::list< std::string > oldIdents;
    144148        std::list< Declaration* > oldDecls;
    145         std::list< Attribute * > attributes;
    146149};
    147150
  • src/SynTree/DeclarationWithType.cc

    r950f7a7 r7527e63  
    1616#include "Declaration.h"
    1717#include "Type.h"
     18#include "Attribute.h"
    1819#include "Common/utility.h"
    1920
    20 DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage )
    21                 : Declaration( name, sc, linkage ) {
     21DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, const std::list< Attribute * > & attributes )
     22                : Declaration( name, sc, linkage ), attributes( attributes ) {
    2223}
    2324
    2425DeclarationWithType::DeclarationWithType( const DeclarationWithType &other )
    2526                : Declaration( other ), mangleName( other.mangleName ), scopeLevel( other.scopeLevel ) {
     27        cloneAll( other.attributes, attributes );
    2628}
    2729
    2830DeclarationWithType::~DeclarationWithType() {
     31        deleteAll( attributes );
    2932}
    3033
  • src/SynTree/Expression.cc

    r950f7a7 r7527e63  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun 13 16:03:39 2016
    13 // Update Count     : 42
     12// Last Modified On : Fri Aug  5 14:23:56 2016
     13// Update Count     : 49
    1414//
    1515
     
    344344}
    345345
     346//// is this right? It's cloning the member, but the member is a declaration so probably shouldn't be cloned...
    346347MemberExpr::MemberExpr( const MemberExpr &other ) :
    347                 Expression( other ), member( maybeClone( other.member ) ), aggregate( maybeClone( other.aggregate ) ) {
     348                Expression( other ), member( other.member ), aggregate( maybeClone( other.aggregate ) ) {
    348349}
    349350
    350351MemberExpr::~MemberExpr() {
    351         delete member;
     352        // delete member;
    352353        delete aggregate;
    353354}
     
    528529}
    529530
     531RangeExpr::RangeExpr( Expression *low, Expression *high ) : low( low ), high( high ) {}
     532RangeExpr::RangeExpr( const RangeExpr &other ) : low( other.low->clone() ), high( other.high->clone() ) {}
     533void RangeExpr::print( std::ostream &os, int indent ) const {
     534        os << std::string( indent, ' ' ) << "Range Expression: ";
     535        low->print( os, indent );
     536        os << " ... ";
     537        high->print( os, indent );
     538}
    530539
    531540std::ostream & operator<<( std::ostream & out, Expression * expr ) {
  • 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
  • src/SynTree/FunctionDecl.cc

    r950f7a7 r7527e63  
    2323
    2424FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, std::list< Attribute * > attributes )
    25                 : Parent( name, sc, linkage ), type( type ), statements( statements ), attributes( attributes ) {
     25                : Parent( name, sc, linkage, attributes ), type( type ), statements( statements ) {
    2626        set_isInline( isInline );
    2727        set_isNoreturn( isNoreturn );
     
    3434FunctionDecl::FunctionDecl( const FunctionDecl &other )
    3535        : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {
    36                 cloneAll( other.attributes, attributes );
    3736}
    3837
     
    4039        delete type;
    4140        delete statements;
    42         deleteAll( attributes );
    4341}
    4442
     
    6967        } // if
    7068
    71         printAll( attributes, os, indent );
     69        printAll( get_attributes(), os, indent );
    7270
    7371        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
  • src/SynTree/Initializer.h

    r950f7a7 r7527e63  
    9393        std::list<Initializer*> &get_initializers() { return initializers; }
    9494
    95         std::list<Initializer*>::iterator begin_initializers() { return initializers.begin(); }
    96         std::list<Initializer*>::iterator end_initializers() { return initializers.end(); }
     95        typedef std::list<Initializer*>::iterator iterator;
     96        iterator begin() { return initializers.begin(); }
     97        iterator end() { return initializers.end(); }
    9798
    9899        virtual ListInit *clone() const { return new ListInit( *this ); }
  • src/SynTree/Label.h

    r950f7a7 r7527e63  
    99// Author           : Rob Schluntz
    1010// Created On       : Wed Jun 8 12:53:12 2016
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Jun 8 12:53:28 2016
    13 // Update Count     : 1
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sun Aug  7 14:44:29 2016
     13// Update Count     : 2
    1414//
    1515
     
    2424class Label {
    2525  public:
    26         Label( const std::string & name = "", Statement * labelled = 0 ) : name( name ), labelled( labelled ) {}
     26        Label( const std::string & name = "", Statement * labelled = 0, const std::list< Attribute * > & attributes = std::list< Attribute * >() ) : name( name ), labelled( labelled ), attributes( attributes ) {}
    2727        Label( const char * name, Statement * labelled = 0 ) : name( name ), labelled( labelled ) {}
    2828
  • src/SynTree/Mutator.cc

    r950f7a7 r7527e63  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:51:19 2016
    13 // Update Count     : 17
     12// Last Modified On : Thu Aug  4 11:23:21 2016
     13// Update Count     : 19
    1414//
    1515
     
    126126Statement *Mutator::mutate( SwitchStmt *switchStmt ) {
    127127        switchStmt->set_condition( maybeMutate( switchStmt->get_condition(), *this ) );
    128         mutateAll( switchStmt->get_branches(), *this );
     128        mutateAll( switchStmt->get_statements(), *this );
    129129        return switchStmt;
    130130}
     
    349349        compLitExpr->set_initializer( maybeMutate( compLitExpr->get_initializer(), *this ) );
    350350        return compLitExpr;
     351}
     352
     353Expression *Mutator::mutate( RangeExpr *rangeExpr ) {
     354        rangeExpr->set_low( maybeMutate( rangeExpr->get_low(), *this ) );
     355        rangeExpr->set_high( maybeMutate( rangeExpr->get_high(), *this ) );
     356        return rangeExpr;
    351357}
    352358
  • src/SynTree/Mutator.h

    r950f7a7 r7527e63  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:51:43 2016
    13 // Update Count     : 11
     12// Last Modified On : Wed Aug  3 16:59:45 2016
     13// Update Count     : 12
    1414//
    1515#include <cassert>
     
    7878        virtual Expression* mutate( UntypedValofExpr *valofExpr );
    7979        virtual Expression* mutate( CompoundLiteralExpr *compLitExpr );
     80        virtual Expression* mutate( RangeExpr *rangeExpr );
    8081
    8182        virtual Type* mutate( VoidType *basicType );
  • src/SynTree/ObjectDecl.cc

    r950f7a7 r7527e63  
    1818#include "Initializer.h"
    1919#include "Expression.h"
     20#include "Attribute.h"
    2021#include "Common/utility.h"
    2122#include "Statement.h"
    2223
    23 ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, bool isInline, bool isNoreturn )
    24         : Parent( name, sc, linkage ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) {
     24ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, bool isInline, bool isNoreturn )
     25        : Parent( name, sc, linkage, attributes ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) {
    2526        set_isInline( isInline );
    2627        set_isNoreturn( isNoreturn );
     
    4546                os << LinkageSpec::toString( get_linkage() ) << " ";
    4647        } // if
     48
     49        printAll( get_attributes(), os, indent );
    4750
    4851        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
     
    8083        } // if
    8184
     85        // xxx - should printShort print attributes?
     86
    8287        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    8388                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
  • src/SynTree/Statement.cc

    r950f7a7 r7527e63  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:52:32 2016
    13 // Update Count     : 55
     12// Last Modified On : Fri Aug 12 13:58:48 2016
     13// Update Count     : 62
    1414//
    1515
     
    143143}
    144144
    145 SwitchStmt::SwitchStmt( std::list<Label> _labels, Expression * _condition, std::list<Statement *> &_branches ):
    146         Statement( _labels ), condition( _condition ), branches( _branches ) {
     145SwitchStmt::SwitchStmt( std::list<Label> _labels, Expression * _condition, std::list<Statement *> &_statements ):
     146        Statement( _labels ), condition( _condition ), statements( _statements ) {
    147147}
    148148
    149149SwitchStmt::SwitchStmt( const SwitchStmt & other ):
    150150        Statement( other ), condition( maybeClone( other.condition ) ) {
    151         cloneAll( other.branches, branches );
     151        cloneAll( other.statements, statements );
    152152}
    153153
    154154SwitchStmt::~SwitchStmt() {
    155155        delete condition;
    156         // destroy branches
    157 }
    158 
    159 void SwitchStmt::add_case( CaseStmt *c ) {}
     156        // destroy statements
     157}
    160158
    161159void SwitchStmt::print( std::ostream &os, int indent ) const {
     
    164162        os << endl;
    165163
    166         // branches
     164        // statements
    167165        std::list<Statement *>::const_iterator i;
    168         for ( i = branches.begin(); i != branches.end(); i++)
     166        for ( i = statements.begin(); i != statements.end(); i++)
    169167                (*i)->print( os, indent + 4 );
    170168
    171         //for_each( branches.begin(), branches.end(), mem_fun( bind1st(&Statement::print ), os ));
     169        //for_each( statements.begin(), statements.end(), mem_fun( bind1st(&Statement::print ), os ));
    172170}
    173171
     
    187185}
    188186
    189 CaseStmt * CaseStmt::makeDefault( std::list<Label> labels, std::list<Statement *> branches ) {
    190         return new CaseStmt( labels, 0, branches, true );
     187CaseStmt * CaseStmt::makeDefault( std::list<Label> labels, std::list<Statement *> stmts ) {
     188        return new CaseStmt( labels, 0, stmts, true );
    191189}
    192190
     
    311309}
    312310
    313 CatchStmt::CatchStmt( std::list<Label> labels, Declaration *_decl, Statement *_body, bool isCatchRest ) :
    314         Statement( labels ), decl ( _decl ), body( _body ), catchRest ( isCatchRest ) {
     311CatchStmt::CatchStmt( std::list<Label> labels, Declaration *_decl, Statement *_body, bool catchAny ) :
     312        Statement( labels ), decl ( _decl ), body( _body ), catchRest ( catchAny ) {
    315313}
    316314
  • src/SynTree/Statement.h

    r950f7a7 r7527e63  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:53:29 2016
    13 // Update Count     : 47
     12// Last Modified On : Fri Aug 12 13:57:46 2016
     13// Update Count     : 65
    1414//
    1515
     
    129129class SwitchStmt : public Statement {
    130130  public:
    131         SwitchStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &branches );
     131        SwitchStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &statements );
    132132        SwitchStmt( const SwitchStmt &other );
    133133        virtual ~SwitchStmt();
     
    136136        void set_condition( Expression *newValue ) { condition = newValue; }
    137137
    138         std::list<Statement *> & get_branches() { return branches; }
    139         void add_case( CaseStmt * );
     138        std::list<Statement *> & get_statements() { return statements; }
    140139
    141140        virtual void accept( Visitor &v ) { v.visit( this ); }
     
    146145  private:
    147146        Expression * condition;
    148         std::list<Statement *> branches; // should be list of CaseStmt
     147        std::list<Statement *> statements;
    149148};
    150149
    151150class CaseStmt : public Statement {
    152151  public:
    153         CaseStmt( std::list<Label> labels, Expression *conditions,
    154               std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError);
     152        CaseStmt( std::list<Label> labels, Expression *conditions, std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError);
    155153        CaseStmt( const CaseStmt &other );
    156154        virtual ~CaseStmt();
    157155
    158         static CaseStmt * makeDefault( std::list<Label> labels = std::list<Label>(),
    159                 std::list<Statement *> stmts = std::list<Statement *>() );
     156        static CaseStmt * makeDefault( std::list<Label> labels = std::list<Label>(), std::list<Statement *> stmts = std::list<Statement *>() );
    160157
    161158        bool isDefault() const { return _isDefault; }
     
    317314class CatchStmt : public Statement {
    318315  public:
    319         CatchStmt( std::list<Label> labels, Declaration *decl, Statement *body, bool isCatchRest = false );
     316        CatchStmt( std::list<Label> labels, Declaration *decl, Statement *body, bool catchAny = false );
    320317        CatchStmt( const CatchStmt &other );
    321318        virtual ~CatchStmt();
  • src/SynTree/SynTree.h

    r950f7a7 r7527e63  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:54:02 2016
    13 // Update Count     : 6
     12// Last Modified On : Wed Aug  3 17:02:34 2016
     13// Update Count     : 7
    1414//
    1515
     
    8383class UntypedValofExpr;
    8484class CompoundLiteralExpr;
     85class RangeExpr;
    8586
    8687class Type;
  • src/SynTree/Visitor.cc

    r950f7a7 r7527e63  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:54:39 2016
    13 // Update Count     : 19
     12// Last Modified On : Thu Aug  4 11:24:25 2016
     13// Update Count     : 21
    1414//
    1515
     
    109109void Visitor::visit( SwitchStmt *switchStmt ) {
    110110        maybeAccept( switchStmt->get_condition(), *this );
    111         acceptAll( switchStmt->get_branches(), *this );
     111        acceptAll( switchStmt->get_statements(), *this );
    112112}
    113113
     
    296296        maybeAccept( compLitExpr->get_type(), *this );
    297297        maybeAccept( compLitExpr->get_initializer(), *this );
     298}
     299
     300void Visitor::visit( RangeExpr *rangeExpr ) {
     301        maybeAccept( rangeExpr->get_low(), *this );
     302        maybeAccept( rangeExpr->get_high(), *this );
    298303}
    299304
  • src/SynTree/Visitor.h

    r950f7a7 r7527e63  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:55:09 2016
    13 // Update Count     : 8
     12// Last Modified On : Wed Aug  3 17:01:50 2016
     13// Update Count     : 9
    1414//
    1515
     
    7878        virtual void visit( UntypedValofExpr *valofExpr );
    7979        virtual void visit( CompoundLiteralExpr *compLitExpr );
     80        virtual void visit( RangeExpr *rangeExpr );
    8081
    8182        virtual void visit( VoidType *basicType );
Note: See TracChangeset for help on using the changeset viewer.