Changeset 974906e2 for src/SynTree


Ignore:
Timestamp:
Jan 11, 2016, 2:48:05 PM (10 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
a56767c
Parents:
1e9d87b
Message:

propagate maybeConstructed flag through system, begin create constructor/destructor statements for further processing by Resolver

Location:
src/SynTree
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Declaration.h

    r1e9d87b r974906e2  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Declaration.h -- 
     7// Declaration.h --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Dec 09 14:08:22 2015
    13 // Update Count     : 32
     12// Last Modified On : Thu Jan 07 14:48:44 2016
     13// Update Count     : 34
    1414//
    1515
     
    9191        Expression *get_bitfieldWidth() const { return bitfieldWidth; }
    9292        void set_bitfieldWidth( Expression *newValue ) { bitfieldWidth = newValue; }
     93        ExprStmt * get_ctor() const { return ctor; }
     94        void set_ctor( ExprStmt * newValue ) { ctor = newValue; }
    9395
    9496        virtual ObjectDecl *clone() const { return new ObjectDecl( *this ); }
     
    101103        Initializer *init;
    102104        Expression *bitfieldWidth;
     105        ExprStmt * ctor;
    103106};
    104107
  • src/SynTree/Initializer.cc

    r1e9d87b r974906e2  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Initializer.cc -- 
     7// Initializer.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Aug 12 14:05:25 2015
    13 // Update Count     : 14
     12// Last Modified On : Thu Jan 07 15:00:18 2016
     13// Update Count     : 23
    1414//
    1515
     
    1818#include "utility.h"
    1919
    20 Initializer::Initializer() {}
     20Initializer::Initializer( bool maybeConstructed ) : maybeConstructed( maybeConstructed ) {}
    2121
    2222Initializer::~Initializer() {}
     
    3131void Initializer::print( std::ostream &os, int indent ) {}
    3232
    33 SingleInit::SingleInit( Expression *v, std::list< Expression *> &_designators ) : value ( v ), designators( _designators ) {
     33SingleInit::SingleInit( Expression *v, std::list< Expression *> &_designators, bool maybeConstructed ) : Initializer( maybeConstructed ), value ( v ), designators( _designators ) {
    3434}
    3535
    36 SingleInit::SingleInit( const SingleInit &other ) : value ( other.value ) {
     36SingleInit::SingleInit( const SingleInit &other ) : Initializer(other), value ( other.value ) {
    3737        cloneAll(other.designators, designators );
    3838}
     
    5454}
    5555
    56 ListInit::ListInit( std::list<Initializer*> &_initializers, std::list<Expression *> &_designators )
    57         : initializers( _initializers ), designators( _designators ) {
     56ListInit::ListInit( std::list<Initializer*> &_initializers, std::list<Expression *> &_designators, bool maybeConstructed )
     57        : Initializer( maybeConstructed), initializers( _initializers ), designators( _designators ) {
    5858}
    5959
     
    6565
    6666void ListInit::print( std::ostream &os, int indent ) {
    67         os << std::endl << std::string(indent, ' ') << "Compound initializer:  "; 
     67        os << std::endl << std::string(indent, ' ') << "Compound initializer:  ";
    6868        if ( ! designators.empty() ) {
    6969                os << std::string(indent + 2, ' ' ) << "designated by: [";
    7070                for ( std::list < Expression * >::iterator i = designators.begin();
    7171                          i != designators.end(); i++ ) {
    72                         ( *i )->print(os, indent + 4 ); 
     72                        ( *i )->print(os, indent + 4 );
    7373                } // for
    74        
     74
    7575                os << std::string(indent + 2, ' ' ) << "]";
    7676        } // if
    7777
    78         for ( std::list<Initializer *>::iterator i = initializers.begin(); i != initializers.end(); i++ ) 
     78        for ( std::list<Initializer *>::iterator i = initializers.begin(); i != initializers.end(); i++ )
    7979                (*i)->print( os, indent + 2 );
    8080}
  • src/SynTree/Initializer.h

    r1e9d87b r974906e2  
    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 : Thu Jan 07 13:33:20 2016
     13// Update Count     : 5
    1414//
    1515
     
    2727  public:
    2828        //      Initializer( std::string _name = std::string(""), int _pos = 0 );
    29         Initializer( );
     29        Initializer( bool maybeConstructed );
    3030        virtual ~Initializer();
    3131
     
    4343        }
    4444
     45        bool get_maybeConstructed() { return maybeConstructed; }
     46
    4547        virtual Initializer *clone() const = 0;
    4648        virtual void accept( Visitor &v ) = 0;
     
    5052        //      std::string name;
    5153        //      int pos;
     54        bool maybeConstructed;
    5255};
    5356
     
    5558class SingleInit : public Initializer {
    5659  public:
    57         SingleInit( Expression *value, std::list< Expression *> &designators );
     60        SingleInit( Expression *value, std::list< Expression *> &designators, bool maybeConstructed );
    5861        SingleInit( const SingleInit &other );
    5962        virtual ~SingleInit();
    60        
     63
    6164        Expression *get_value() { return value; }
    6265        void set_value( Expression *newValue ) { value = newValue; }
     
    7982class ListInit : public Initializer {
    8083  public:
    81         ListInit( std::list<Initializer*> &, 
    82                           std::list<Expression *> &designators = *(new std::list<Expression *>()) );
     84        ListInit( std::list<Initializer*> &,
     85                          std::list<Expression *> &designators, bool maybeConstructed );
    8386        virtual ~ListInit();
    8487
  • src/SynTree/ObjectDecl.cc

    r1e9d87b r974906e2  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ObjectDecl.cc -- 
     7// ObjectDecl.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue Sep 29 14:13:01 2015
    13 // Update Count     : 18
     12// Last Modified On : Fri Jan 08 15:29:10 2016
     13// Update Count     : 27
    1414//
    1515
     
    1919#include "Expression.h"
    2020#include "utility.h"
     21#include "Statement.h"
    2122
    2223ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, bool isInline, bool isNoreturn )
     
    2425        set_isInline( isInline );
    2526        set_isNoreturn( isNoreturn );
     27        set_ctor( NULL );
    2628}
    2729
    2830ObjectDecl::ObjectDecl( const ObjectDecl &other )
    29         : Parent( other ), type( maybeClone( other.type ) ), init( maybeClone( other.init ) ), bitfieldWidth( maybeClone( other.bitfieldWidth ) ) {
     31        : Parent( other ), type( maybeClone( other.type ) ), init( maybeClone( other.init ) ), bitfieldWidth( maybeClone( other.bitfieldWidth ) ), ctor( maybeClone( other.ctor ) ) {
    3032}
    3133
     
    3436        delete init;
    3537        delete bitfieldWidth;
     38        delete ctor;
    3639}
    3740
     
    5861                os << " with initializer ";
    5962                init->print( os, indent );
     63                os << std::string(indent, ' ') << "maybeConstructed? " << init->get_maybeConstructed();
    6064        } // if
    6165
     
    6468                bitfieldWidth->print( os );
    6569        } // if
     70
     71        if ( ctor ) {
     72                os << " initially constructed with ";
     73                ctor->print( os, indent );
     74        } // if
    6675}
    6776
     
    6978#if 0
    7079        if ( get_mangleName() != "") {
    71                 os << get_mangleName() << ": "; 
    72         } else 
     80                os << get_mangleName() << ": ";
     81        } else
    7382#endif
    7483        if ( get_name() != "" ) {
Note: See TracChangeset for help on using the changeset viewer.