Changeset bac5158 for src/Parser
- Timestamp:
- Jul 15, 2017, 9:47:54 AM (7 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, resolv-new, with_gc
- Children:
- 478b1d0
- Parents:
- 994d080 (diff), 6ea87486 (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
r994d080 rbac5158 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:27:00 201713 // Update Count : 10 1912 // Last Modified On : Fri Jul 14 16:55:00 2017 13 // Update Count : 1020 14 14 // 15 15 … … 253 253 newnode->type->aggregate.fields = fields; 254 254 newnode->type->aggregate.body = body; 255 newnode->type->aggregate.tagged = false; 256 newnode->type->aggregate.parent = nullptr; 255 257 return newnode; 256 258 } // DeclarationNode::newAggregate … … 273 275 return newnode; 274 276 } // DeclarationNode::newEnumConstant 277 278 DeclarationNode * DeclarationNode::newTreeStruct( Aggregate kind, const string * name, const string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body ) { 279 assert( name ); 280 DeclarationNode * newnode = new DeclarationNode; 281 newnode->type = new TypeData( TypeData::Aggregate ); 282 newnode->type->aggregate.kind = kind; 283 newnode->type->aggregate.name = name; 284 newnode->type->aggregate.actuals = actuals; 285 newnode->type->aggregate.fields = fields; 286 newnode->type->aggregate.body = body; 287 newnode->type->aggregate.tagged = true; 288 newnode->type->aggregate.parent = parent; 289 return newnode; 290 } // DeclarationNode::newTreeStruct 275 291 276 292 DeclarationNode * DeclarationNode::newName( string * name ) { -
src/Parser/ParseNode.h
r994d080 rbac5158 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jun 12 13:00:00 201713 // Update Count : 7 7912 // Last Modified On : Fri Jul 14 16:56:00 2017 13 // Update Count : 780 14 14 // 15 15 … … 248 248 static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement 249 249 250 // Perhaps this would best fold into newAggragate. 251 static DeclarationNode * newTreeStruct( Aggregate kind, const std::string * name, const std::string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body ); 252 250 253 DeclarationNode(); 251 254 ~DeclarationNode(); … … 332 335 333 336 static UniqueName anonymous; 337 338 // Temp to test TreeStruct 339 const std::string * parent_name; 334 340 }; // DeclarationNode 335 341 -
src/Parser/TypeData.cc
r994d080 rbac5158 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:28:00 201713 // Update Count : 56 412 // Last Modified On : Fri Jul 14 16:58:00 2017 13 // Update Count : 565 14 14 // 15 15 … … 63 63 aggregate.fields = nullptr; 64 64 aggregate.body = false; 65 aggregate.tagged = false; 66 aggregate.parent = nullptr; 65 67 break; 66 68 case AggregateInst: … … 121 123 delete aggregate.actuals; 122 124 delete aggregate.fields; 125 delete aggregate.parent; 123 126 // delete aggregate; 124 127 break; … … 192 195 newtype->aggregate.kind = aggregate.kind; 193 196 newtype->aggregate.body = aggregate.body; 197 newtype->aggregate.tagged = aggregate.tagged; 198 newtype->aggregate.parent = aggregate.parent ? new string( *aggregate.parent ) : nullptr; 194 199 break; 195 200 case AggregateInst: … … 619 624 switch ( td->aggregate.kind ) { 620 625 case DeclarationNode::Struct: 626 if ( td->aggregate.tagged ) { 627 at = new StructDecl( *td->aggregate.name, td->aggregate.parent, attributes, linkage ); 628 buildForall( td->aggregate.params, at->get_parameters() ); 629 break; 630 } 621 631 case DeclarationNode::Coroutine: 622 632 case DeclarationNode::Monitor: -
src/Parser/TypeData.h
r994d080 rbac5158 10 10 // Created On : Sat May 16 15:18:36 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:29:00 201713 // Update Count : 18 612 // Last Modified On : Fri Jul 14 16:57:00 2017 13 // Update Count : 187 14 14 // 15 15 … … 31 31 DeclarationNode * fields; 32 32 bool body; 33 34 bool tagged; 35 const std::string * parent; 33 36 }; 34 37 -
src/Parser/parser.yy
r994d080 rbac5158 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 15 0 8:17:48201713 // Update Count : 245 012 // Last Modified On : Sat Jul 15 09:46:26 2017 13 // Update Count : 2451 14 14 // 15 15 … … 1679 1679 | aggregate_key attribute_list_opt typegen_name // CFA 1680 1680 { $$ = $3->addQualifiers( $2 ); } 1681 1682 // Temp, testing TreeStruct 1683 | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name 1684 { 1685 typedefTable.makeTypedef( *$4 ); // create typedef 1686 if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $ 1687 forall = false; // reset 1688 } 1689 '{' field_declaration_list '}' 1690 { 1691 $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct, 1692 $4, nullptr, nullptr, $7, true )->addQualifiers( $3 ); 1693 } 1694 | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name TYPEDEFname 1695 { 1696 typedefTable.makeTypedef( *$4 ); // create typedef 1697 if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $ 1698 forall = false; // reset 1699 } 1700 '{' field_declaration_list '}' 1701 { 1702 $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct, 1703 $4, $5, nullptr, $8, true )->addQualifiers( $3 ); 1704 } 1681 1705 ; 1682 1706
Note: See TracChangeset
for help on using the changeset viewer.