Ignore:
Timestamp:
Jun 30, 2016, 4:32:56 PM (10 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, 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:
ea29e73
Parents:
1b5c81ed (diff), 84d4d6f (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 gc_noraii

Conflicts:

Jenkinsfile
src/SymTab/Validate.cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Initializer.h

    r1b5c81ed rf80e0218  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Initializer.h -- 
     7// Initializer.h --
    88//
    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 : Mon May 18 09:03:48 2015
    13 // Update Count     : 1
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Tue Apr 12 13:49:13 2016
     13// Update Count     : 19
    1414//
    1515
     
    2020#include "Visitor.h"
    2121#include "Mutator.h"
     22#include "Type.h"
    2223
    2324#include <cassert>
     
    2728  public:
    2829        //      Initializer( std::string _name = std::string(""), int _pos = 0 );
    29         Initializer( );
     30        Initializer( bool maybeConstructed );
     31        Initializer( const Initializer & other );
    3032        virtual ~Initializer();
    3133
     
    4345        }
    4446
     47        bool get_maybeConstructed() { return maybeConstructed; }
     48
    4549        virtual Initializer *clone() const = 0;
    4650        virtual void accept( Visitor &v ) = 0;
     
    5054        //      std::string name;
    5155        //      int pos;
     56        bool maybeConstructed;
    5257};
    5358
     
    5560class SingleInit : public Initializer {
    5661  public:
    57         SingleInit( Expression *value, std::list< Expression *> &designators = *(new std::list<Expression *>()) );
     62        SingleInit( Expression *value, const std::list< Expression *> &designators = std::list< Expression * >(), bool maybeConstructed = false );
    5863        SingleInit( const SingleInit &other );
    5964        virtual ~SingleInit();
    60        
     65
    6166        Expression *get_value() { return value; }
    6267        void set_value( Expression *newValue ) { value = newValue; }
     
    6570        std::list<Expression *> &get_designators() { return designators; }
    6671
    67         virtual SingleInit *clone() const;
     72        virtual SingleInit *clone() const { return new SingleInit( *this); }
    6873        virtual void accept( Visitor &v ) { v.visit( this ); }
    6974        virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     
    7984class ListInit : public Initializer {
    8085  public:
    81         ListInit( std::list<Initializer*> &,
    82                           std::list<Expression *> &designators = *(new std::list<Expression *>()) );
     86        ListInit( const std::list<Initializer*> &initializers,
     87                          const std::list<Expression *> &designators = std::list< Expression * >(), bool maybeConstructed = false );
    8388        virtual ~ListInit();
    8489
     
    9196        std::list<Initializer*>::iterator end_initializers() { return initializers.end(); }
    9297
    93         virtual ListInit *clone() const;
     98        virtual ListInit *clone() const { return new ListInit( *this ); }
    9499        virtual void accept( Visitor &v ) { v.visit( this ); }
    95100        virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     
    100105};
    101106
     107// ConstructorInit represents an initializer that is either a constructor expression or
     108// a C-style initializer.
     109class ConstructorInit : public Initializer {
     110  public:
     111        ConstructorInit( Statement * ctor, Statement * dtor, Initializer * init );
     112        ConstructorInit( const ConstructorInit &other );
     113        virtual ~ConstructorInit();
     114
     115        void set_ctor( Statement * newValue ) { ctor = newValue; }
     116        Statement * get_ctor() const { return ctor; }
     117        void set_dtor( Statement * newValue ) { dtor = newValue; }
     118        Statement * get_dtor() const { return dtor; }
     119        void set_init( Initializer * newValue ) { init = newValue; }
     120        Initializer * get_init() const { return init; }
     121
     122        ConstructorInit *clone() const { return new ConstructorInit( *this ); }
     123        virtual void accept( Visitor &v ) { v.visit( this ); }
     124        virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     125        virtual void print( std::ostream &os, int indent = 0 );
     126
     127  private:
     128        Statement * ctor;
     129        Statement * dtor;
     130        // C-style initializer made up of SingleInit and ListInit nodes to use as a fallback
     131        // if an appropriate constructor definition is not found by the resolver
     132        Initializer * init;
     133};
     134
     135std::ostream & operator<<( std::ostream & out, Initializer * init );
     136
    102137#endif // INITIALIZER_H
    103138
Note: See TracChangeset for help on using the changeset viewer.