Changeset 974906e2 for src/Parser


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/Parser
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r1e9d87b r974906e2  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // DeclarationNode.cc -- 
     7// DeclarationNode.cc --
    88//
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 12:34:05 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 14 14:46:32 2015
    13 // Update Count     : 126
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Thu Jan 07 13:18:02 2016
     13// Update Count     : 130
    1414//
    1515
     
    9696                os << endl << string( indent + 2, ' ' ) << "with initializer ";
    9797                initializer->printOneLine( os );
     98                os << " maybe constructed? " << initializer->get_maybeConstructed();
     99
    98100        } // if
    99101
     
    357359        } // if
    358360}
    359          
     361
    360362DeclarationNode *DeclarationNode::addQualifiers( DeclarationNode *q ) {
    361363        if ( q ) {
     
    508510                assert( false );
    509511        } // switch
    510        
     512
    511513        return this;
    512514}
     
    619621                assert( a->type->kind == TypeData::Array );
    620622                TypeData *lastArray = findLast( a->type );
    621                 if ( type ) { 
     623                if ( type ) {
    622624                        switch ( type->kind ) {
    623625                          case TypeData::Aggregate:
     
    663665        } // if
    664666}
    665        
     667
    666668DeclarationNode *DeclarationNode::addIdList( DeclarationNode *ids ) {
    667669        type = addIdListToType( type, ids );
     
    868870Type *DeclarationNode::buildType() const {
    869871        assert( type );
    870  
     872
    871873        switch ( type->kind ) {
    872874          case TypeData::Enum:
  • src/Parser/InitializerNode.cc

    r1e9d87b r974906e2  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // InitializerNode.cc -- 
    8 // 
     7// InitializerNode.cc --
     8//
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:20:24 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Oct  8 17:18:55 2015
    13 // Update Count     : 4
    14 // 
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Thu Jan 07 13:32:57 2016
     13// Update Count     : 13
     14//
    1515
    1616#include <cassert>
     
    2323
    2424InitializerNode::InitializerNode( ExpressionNode *_expr, bool aggrp, ExpressionNode *des )
    25         : expr( _expr ), aggregate( aggrp ), designator( des ), kids( 0 ) {
     25        : expr( _expr ), aggregate( aggrp ), designator( des ), kids( 0 ), maybeConstructed( true ) {
    2626        if ( aggrp )
    2727                kids = dynamic_cast< InitializerNode *>( get_link() );
     
    3232
    3333InitializerNode::InitializerNode( InitializerNode *init, bool aggrp, ExpressionNode *des )
    34         : expr( 0 ), aggregate( aggrp ), designator( des ), kids( 0 ) {
     34        : expr( 0 ), aggregate( aggrp ), designator( des ), kids( 0 ), maybeConstructed( true ) {
    3535        if ( init != 0 )
    3636                set_link(init);
     
    9191                } // if
    9292
    93                 return new ListInit( initlist, designlist );
     93                return new ListInit( initlist, designlist, maybeConstructed );
    9494        } else {
    9595                std::list< Expression *> designators;
     
    9999
    100100                if ( get_expression() != 0)
    101                         return new SingleInit( get_expression()->build(), designators );
     101                        return new SingleInit( get_expression()->build(), designators, maybeConstructed );
    102102        } // if
    103103
  • src/Parser/ParseNode.h

    r1e9d87b r974906e2  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ParseNode.h -- 
     7// ParseNode.h --
    88//
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Aug 19 15:59:27 2015
    13 // Update Count     : 174
     12// Last Modified On : Thu Jan 07 13:17:46 2016
     13// Update Count     : 177
    1414//
    1515
     
    175175  public:
    176176        enum Type { TupleC, Comma, TupleFieldSel,
    177                                 Cond, NCond, 
    178                                 SizeOf, AlignOf, Attr, CompLit, Plus, Minus, Mul, Div, Mod, Or, And, 
    179                                 BitOr, BitAnd, Xor, Cast, LShift, RShift, LThan, GThan, LEThan, GEThan, Eq, Neq, 
    180                                 Assign, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, 
     177                                Cond, NCond,
     178                                SizeOf, AlignOf, Attr, CompLit, Plus, Minus, Mul, Div, Mod, Or, And,
     179                                BitOr, BitAnd, Xor, Cast, LShift, RShift, LThan, GThan, LEThan, GEThan, Eq, Neq,
     180                                Assign, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn,
    181181                                ERAssn, OrAssn, Index, FieldSel, PFieldSel, Range,
    182182                                UnPlus, UnMinus, AddressOf, PointTo, Neg, BitNeg, Incr, IncrPost, Decr, DecrPost, LabelAddress,
     
    307307        ValofExprNode( const ValofExprNode &other );
    308308        ~ValofExprNode();
    309  
     309
    310310        virtual ValofExprNode *clone() const { return new ValofExprNode( *this ); }
    311311
     
    330330        enum TypeClass { Type, Dtype, Ftype };
    331331
    332         static const char *storageName[]; 
     332        static const char *storageName[];
    333333        static const char *qualifierName[];
    334334        static const char *basicTypeName[];
     
    420420class StatementNode : public ParseNode {
    421421  public:
    422         enum Type { Exp,   If,        Switch,  Case,    Default,  Choose,   Fallthru, 
     422        enum Type { Exp,   If,        Switch,  Case,    Default,  Choose,   Fallthru,
    423423                                While, Do,        For,
    424424                                Goto,  Continue,  Break,   Return,  Throw,
     
    518518        ExpressionNode *get_designators() const { return designator; }
    519519
     520        InitializerNode *set_maybeConstructed( bool value ) { maybeConstructed = value; return this; }
     521        bool get_maybeConstructed() const { return maybeConstructed; }
     522
    520523        InitializerNode *next_init() const { return kids; }
    521524
     
    529532        ExpressionNode *designator; // may be list
    530533        InitializerNode *kids;
     534        bool maybeConstructed;
    531535};
    532536
  • src/Parser/parser.cc

    r1e9d87b r974906e2  
    72917291/* Line 1806 of yacc.c  */
    72927292#line 1684 "parser.yy"
    7293     { (yyval.in) = (yyvsp[(2) - (2)].in); }
     7293    { (yyval.in) = (yyvsp[(2) - (2)].in)->set_maybeConstructed( false ); }
    72947294    break;
    72957295
  • src/Parser/parser.yy

    r1e9d87b r974906e2  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // cfa.y -- 
    8 // 
     7// cfa.y --
     8//
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat Sep  1 20:22:55 2001
     
    1212// Last Modified On : Thu Oct  8 17:17:54 2015
    1313// Update Count     : 1473
    14 // 
     14//
    1515
    1616// This grammar is based on the ANSI99/11 C grammar, specifically parts of EXPRESSION and STATEMENTS, and on the C
     
    16821682                { $$ = $2; }
    16831683        | ATassign initializer
    1684                 { $$ = $2; }
     1684                { $$ = $2->set_maybeConstructed( false ); }
    16851685        ;
    16861686
Note: See TracChangeset for help on using the changeset viewer.