Changeset ae32d96 for src/Parser
- Timestamp:
- May 30, 2018, 5:57:43 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
- Children:
- 597c34a3, 6810fcb, 94b1022a, cf5e5b1
- Parents:
- 6b4cdd3 (diff), d15a45d (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. - Location:
- src/Parser
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r6b4cdd3 rae32d96 1067 1067 SemanticError( this, "invalid function specifier for " ); 1068 1068 } // if 1069 return buildDecl( type, name ? *name : string( "" ), storageClasses, maybeBuild< Expression >( bitfieldWidth ), funcSpecs, linkage, asmName, maybeBuild< Initializer >(initializer), attributes )->set_extension( extension ); 1069 bool isDelete = initializer && initializer->get_isDelete(); 1070 Declaration * decl = buildDecl( type, name ? *name : string( "" ), storageClasses, maybeBuild< Expression >( bitfieldWidth ), funcSpecs, linkage, asmName, isDelete ? nullptr : maybeBuild< Initializer >(initializer), attributes )->set_extension( extension ); 1071 if ( isDelete ) { 1072 DeclarationWithType * dwt = strict_dynamic_cast<DeclarationWithType *>( decl ); 1073 dwt->isDeleted = true; 1074 } 1075 return decl; 1070 1076 } // if 1071 1077 -
src/Parser/InitializerNode.cc
r6b4cdd3 rae32d96 27 27 28 28 InitializerNode::InitializerNode( ExpressionNode * _expr, bool aggrp, ExpressionNode * des ) 29 : expr( _expr ), aggregate( aggrp ), designator( des ), kids( nullptr ), maybeConstructed( true ) {29 : expr( _expr ), aggregate( aggrp ), designator( des ), kids( nullptr ), maybeConstructed( true ), isDelete( false ) { 30 30 if ( aggrp ) 31 31 kids = dynamic_cast< InitializerNode * >( get_next() ); … … 36 36 37 37 InitializerNode::InitializerNode( InitializerNode * init, bool aggrp, ExpressionNode * des ) 38 : expr( nullptr ), aggregate( aggrp ), designator( des ), kids( nullptr ), maybeConstructed( true ) {38 : expr( nullptr ), aggregate( aggrp ), designator( des ), kids( nullptr ), maybeConstructed( true ), isDelete( false ) { 39 39 if ( init ) 40 40 set_last( init ); … … 46 46 set_next( nullptr ); 47 47 } // InitializerNode::InitializerNode 48 49 InitializerNode::InitializerNode( bool isDelete ) : expr( nullptr ), aggregate( false ), designator( nullptr ), kids( nullptr ), maybeConstructed( false ), isDelete( isDelete ) {} 48 50 49 51 InitializerNode::~InitializerNode() { … … 84 86 85 87 Initializer * InitializerNode::build() const { 88 assertf( ! isDelete, "Should not build delete stmt InitializerNode" ); 86 89 if ( aggregate ) { 87 90 // steal designators from children -
src/Parser/ParseNode.h
r6b4cdd3 rae32d96 87 87 InitializerNode( ExpressionNode *, bool aggrp = false, ExpressionNode * des = nullptr ); 88 88 InitializerNode( InitializerNode *, bool aggrp = false, ExpressionNode * des = nullptr ); 89 InitializerNode( bool isDelete ); 89 90 ~InitializerNode(); 90 91 virtual InitializerNode * clone() const { assert( false ); return nullptr; } … … 97 98 InitializerNode * set_maybeConstructed( bool value ) { maybeConstructed = value; return this; } 98 99 bool get_maybeConstructed() const { return maybeConstructed; } 100 101 bool get_isDelete() const { return isDelete; } 99 102 100 103 InitializerNode * next_init() const { return kids; } … … 110 113 InitializerNode * kids; 111 114 bool maybeConstructed; 115 bool isDelete; 112 116 }; // InitializerNode 113 117 -
src/Parser/TypeData.cc
r6b4cdd3 rae32d96 65 65 case Aggregate: 66 66 // aggregate = new Aggregate_t; 67 aggregate.kind = DeclarationNode::NoAggregate; 67 68 aggregate.name = nullptr; 68 69 aggregate.params = nullptr; … … 70 71 aggregate.fields = nullptr; 71 72 aggregate.body = false; 73 aggregate.tagged = false; 74 aggregate.parent = nullptr; 72 75 break; 73 76 case AggregateInst: … … 198 201 break; 199 202 case Aggregate: 203 newtype->aggregate.kind = aggregate.kind; 200 204 newtype->aggregate.name = aggregate.name ? new string( *aggregate.name ) : nullptr; 201 205 newtype->aggregate.params = maybeClone( aggregate.params ); 202 206 newtype->aggregate.actuals = maybeClone( aggregate.actuals ); 203 207 newtype->aggregate.fields = maybeClone( aggregate.fields ); 204 newtype->aggregate.kind = aggregate.kind;205 208 newtype->aggregate.body = aggregate.body; 206 209 newtype->aggregate.tagged = aggregate.tagged; -
src/Parser/parser.yy
r6b4cdd3 rae32d96 175 175 bool flag; 176 176 CatchStmt::Kind catch_kind; 177 GenericExpr * genexpr; 177 178 } 178 179 … … 259 260 %type<flag> asm_volatile_opt 260 261 %type<en> handler_predicate_opt 262 %type<genexpr> generic_association generic_assoc_list 261 263 262 264 // statements … … 501 503 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; } 502 504 | GENERIC '(' assignment_expression ',' generic_assoc_list ')' // C11 503 { SemanticError( yylloc, "_Generic is currently unimplemented." ); $$ = nullptr; } 505 { 506 // add the missing control expression to the GenericExpr and return it 507 $5->control = maybeMoveBuild<Expression>( $3 ); 508 $$ = new ExpressionNode( $5 ); 509 } 504 510 ; 505 511 506 512 generic_assoc_list: // C11 507 |generic_association513 generic_association 508 514 | generic_assoc_list ',' generic_association 515 { 516 // steal the association node from the singleton and delete the wrapper 517 $1->associations.splice($1->associations.end(), $3->associations); 518 delete $3; 519 $$ = $1; 520 } 509 521 ; 510 522 511 523 generic_association: // C11 512 524 type_no_function ':' assignment_expression 525 { 526 // create a GenericExpr wrapper with one association pair 527 $$ = new GenericExpr( nullptr, { { maybeMoveBuildType($1), maybeMoveBuild<Expression>($3) } } ); 528 } 513 529 | DEFAULT ':' assignment_expression 530 { $$ = new GenericExpr( nullptr, { { maybeMoveBuild<Expression>($3) } } ); } 514 531 ; 515 532 … … 2084 2101 { $$ = $2; } 2085 2102 | '=' VOID 2086 { $$ = n ullptr; }2103 { $$ = new InitializerNode( true ); } 2087 2104 | ATassign initializer 2088 2105 { $$ = $2->set_maybeConstructed( false ); }
Note: See TracChangeset
for help on using the changeset viewer.