Changeset 974906e2 for src/Parser
- Timestamp:
- Jan 11, 2016, 2:48:05 PM (10 years ago)
- 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
- Location:
- src/Parser
- Files:
-
- 5 edited
-
DeclarationNode.cc (modified) (7 diffs)
-
InitializerNode.cc (modified) (5 diffs)
-
ParseNode.h (modified) (7 diffs)
-
parser.cc (modified) (1 diff)
-
parser.yy (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r1e9d87b r974906e2 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // DeclarationNode.cc -- 7 // DeclarationNode.cc -- 8 8 // 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 12:34:05 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : T ue Jul 14 14:46:32 201513 // Update Count : 1 2611 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Jan 07 13:18:02 2016 13 // Update Count : 130 14 14 // 15 15 … … 96 96 os << endl << string( indent + 2, ' ' ) << "with initializer "; 97 97 initializer->printOneLine( os ); 98 os << " maybe constructed? " << initializer->get_maybeConstructed(); 99 98 100 } // if 99 101 … … 357 359 } // if 358 360 } 359 361 360 362 DeclarationNode *DeclarationNode::addQualifiers( DeclarationNode *q ) { 361 363 if ( q ) { … … 508 510 assert( false ); 509 511 } // switch 510 512 511 513 return this; 512 514 } … … 619 621 assert( a->type->kind == TypeData::Array ); 620 622 TypeData *lastArray = findLast( a->type ); 621 if ( type ) { 623 if ( type ) { 622 624 switch ( type->kind ) { 623 625 case TypeData::Aggregate: … … 663 665 } // if 664 666 } 665 667 666 668 DeclarationNode *DeclarationNode::addIdList( DeclarationNode *ids ) { 667 669 type = addIdListToType( type, ids ); … … 868 870 Type *DeclarationNode::buildType() const { 869 871 assert( type ); 870 872 871 873 switch ( type->kind ) { 872 874 case TypeData::Enum: -
src/Parser/InitializerNode.cc
r1e9d87b r974906e2 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // InitializerNode.cc -- 8 // 7 // InitializerNode.cc -- 8 // 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:20:24 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Oct 8 17:18:55 201513 // Update Count : 414 // 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Jan 07 13:32:57 2016 13 // Update Count : 13 14 // 15 15 16 16 #include <cassert> … … 23 23 24 24 InitializerNode::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 ) { 26 26 if ( aggrp ) 27 27 kids = dynamic_cast< InitializerNode *>( get_link() ); … … 32 32 33 33 InitializerNode::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 ) { 35 35 if ( init != 0 ) 36 36 set_link(init); … … 91 91 } // if 92 92 93 return new ListInit( initlist, designlist );93 return new ListInit( initlist, designlist, maybeConstructed ); 94 94 } else { 95 95 std::list< Expression *> designators; … … 99 99 100 100 if ( get_expression() != 0) 101 return new SingleInit( get_expression()->build(), designators );101 return new SingleInit( get_expression()->build(), designators, maybeConstructed ); 102 102 } // if 103 103 -
src/Parser/ParseNode.h
r1e9d87b r974906e2 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ParseNode.h -- 7 // ParseNode.h -- 8 8 // 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Aug 19 15:59:27 201513 // Update Count : 17 412 // Last Modified On : Thu Jan 07 13:17:46 2016 13 // Update Count : 177 14 14 // 15 15 … … 175 175 public: 176 176 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, 181 181 ERAssn, OrAssn, Index, FieldSel, PFieldSel, Range, 182 182 UnPlus, UnMinus, AddressOf, PointTo, Neg, BitNeg, Incr, IncrPost, Decr, DecrPost, LabelAddress, … … 307 307 ValofExprNode( const ValofExprNode &other ); 308 308 ~ValofExprNode(); 309 309 310 310 virtual ValofExprNode *clone() const { return new ValofExprNode( *this ); } 311 311 … … 330 330 enum TypeClass { Type, Dtype, Ftype }; 331 331 332 static const char *storageName[]; 332 static const char *storageName[]; 333 333 static const char *qualifierName[]; 334 334 static const char *basicTypeName[]; … … 420 420 class StatementNode : public ParseNode { 421 421 public: 422 enum Type { Exp, If, Switch, Case, Default, Choose, Fallthru, 422 enum Type { Exp, If, Switch, Case, Default, Choose, Fallthru, 423 423 While, Do, For, 424 424 Goto, Continue, Break, Return, Throw, … … 518 518 ExpressionNode *get_designators() const { return designator; } 519 519 520 InitializerNode *set_maybeConstructed( bool value ) { maybeConstructed = value; return this; } 521 bool get_maybeConstructed() const { return maybeConstructed; } 522 520 523 InitializerNode *next_init() const { return kids; } 521 524 … … 529 532 ExpressionNode *designator; // may be list 530 533 InitializerNode *kids; 534 bool maybeConstructed; 531 535 }; 532 536 -
src/Parser/parser.cc
r1e9d87b r974906e2 7291 7291 /* Line 1806 of yacc.c */ 7292 7292 #line 1684 "parser.yy" 7293 { (yyval.in) = (yyvsp[(2) - (2)].in) ; }7293 { (yyval.in) = (yyvsp[(2) - (2)].in)->set_maybeConstructed( false ); } 7294 7294 break; 7295 7295 -
src/Parser/parser.yy
r1e9d87b r974906e2 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // cfa.y -- 8 // 7 // cfa.y -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Sep 1 20:22:55 2001 … … 12 12 // Last Modified On : Thu Oct 8 17:17:54 2015 13 13 // Update Count : 1473 14 // 14 // 15 15 16 16 // This grammar is based on the ANSI99/11 C grammar, specifically parts of EXPRESSION and STATEMENTS, and on the C … … 1682 1682 { $$ = $2; } 1683 1683 | ATassign initializer 1684 { $$ = $2 ; }1684 { $$ = $2->set_maybeConstructed( false ); } 1685 1685 ; 1686 1686
Note:
See TracChangeset
for help on using the changeset viewer.