Changes in src/Parser/DeclarationNode.cc [de62360d:2871210]
- File:
-
- 1 edited
-
src/Parser/DeclarationNode.cc (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
rde62360d r2871210 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 24 15:29:19201513 // Update Count : 8612 // Last Modified On : Fri Jul 3 12:35:02 2015 13 // Update Count : 108 14 14 // 15 15 … … 173 173 } 174 174 175 DeclarationNode *DeclarationNode::newAggregate( Aggregate kind, std::string *name, DeclarationNode *formals, ExpressionNode *actuals, DeclarationNode *fields ) {175 DeclarationNode *DeclarationNode::newAggregate( Aggregate kind, const std::string *name, ExpressionNode *actuals, DeclarationNode *fields ) { 176 176 DeclarationNode *newnode = new DeclarationNode; 177 177 newnode->type = new TypeData( TypeData::Aggregate ); 178 178 newnode->type->aggregate->kind = kind; 179 179 newnode->type->aggregate->name = assign_strptr( name ); 180 if ( newnode->type->aggregate->name == "" ) { 180 if ( newnode->type->aggregate->name == "" ) { // anonymous aggregate ? 181 181 newnode->type->aggregate->name = DeclarationNode::anonymous.newName(); 182 } // if 183 184 // SKULLDUGGERY: generate a typedef for the aggregate name so that the aggregate does not have to be qualified by 185 // "struct" 186 typedefTable.addToEnclosingScope( newnode->type->aggregate->name, TypedefTable::TD ); 187 DeclarationNode *typedf = new DeclarationNode; 188 typedf->name = newnode->type->aggregate->name; 189 newnode->appendList( typedf->addType( newnode->clone() )->addTypedef() ); 190 191 newnode->type->aggregate->params = formals; 182 } else { 183 // SKULLDUGGERY: generate a typedef for the aggregate name so that the aggregate does not have to be qualified 184 // by "struct" 185 typedefTable.addToEnclosingScope( newnode->type->aggregate->name, TypedefTable::TD ); 186 DeclarationNode *typedf = new DeclarationNode; 187 typedf->name = newnode->type->aggregate->name; 188 newnode->appendList( typedf->addType( newnode->clone() )->addTypedef() ); 189 } // if 192 190 newnode->type->aggregate->actuals = actuals; 193 newnode->type->aggregate-> members = fields;191 newnode->type->aggregate->fields = fields; 194 192 return newnode; 195 193 } … … 200 198 newnode->type = new TypeData( TypeData::Enum ); 201 199 newnode->type->enumeration->name = newnode->name; 202 if ( newnode->type->enumeration->name == "" ) { 200 if ( newnode->type->enumeration->name == "" ) { // anonymous enumeration ? 203 201 newnode->type->enumeration->name = DeclarationNode::anonymous.newName(); 204 } // if 205 206 // SKULLDUGGERY: generate a typedef for the enumeration name so that the enumeration does not have to be qualified 207 // by "enum" 208 typedefTable.addToEnclosingScope( newnode->type->enumeration->name, TypedefTable::TD ); 209 DeclarationNode *typedf = new DeclarationNode; 210 typedf->name = newnode->type->enumeration->name; 211 newnode->appendList( typedf->addType( newnode->clone() )->addTypedef() ); 212 202 } else { 203 // SKULLDUGGERY: generate a typedef for the enumeration name so that the enumeration does not have to be 204 // qualified by "enum" 205 typedefTable.addToEnclosingScope( newnode->type->enumeration->name, TypedefTable::TD ); 206 DeclarationNode *typedf = new DeclarationNode; 207 typedf->name = newnode->type->enumeration->name; 208 newnode->appendList( typedf->addType( newnode->clone() )->addTypedef() ); 209 } // if 213 210 newnode->type->enumeration->constants = constants; 214 211 return newnode; … … 251 248 newnode->type->aggregate->kind = Context; 252 249 newnode->type->aggregate->params = params; 253 newnode->type->aggregate-> members = asserts;250 newnode->type->aggregate->fields = asserts; 254 251 newnode->type->aggregate->name = assign_strptr( name ); 255 252 return newnode; … … 371 368 if ( type->kind == TypeData::Aggregate ) { 372 369 type->aggregate->params = q->type->forall; 370 // change implicit typedef from TYPEDEFname to TYPEGENname 371 typedefTable.changeKind( type->aggregate->name, TypedefTable::TG ); 373 372 } else { 374 373 type->forall = q->type->forall; … … 407 406 src = 0; 408 407 break; 409 410 408 case TypeData::Basic: 411 409 dst->qualifiers.splice( dst->qualifiers.end(), src->qualifiers ); … … 416 414 } // if 417 415 break; 418 419 416 default: 420 417 switch ( src->kind ) { … … 429 426 src = 0; 430 427 break; 431 432 428 default: 433 429 if ( dst->forall ) { … … 684 680 } else { 685 681 assert( newnode->type->aggInst->aggregate->kind == TypeData::Aggregate ); 686 delete newnode->type->aggInst->aggregate->aggregate-> members;687 newnode->type->aggInst->aggregate->aggregate-> members = 0;682 delete newnode->type->aggInst->aggregate->aggregate->fields; 683 newnode->type->aggInst->aggregate->aggregate->fields = 0; 688 684 } // if 689 685 } // if … … 710 706 } else { 711 707 assert( newType->aggInst->aggregate->kind == TypeData::Aggregate ); 712 delete newType->aggInst->aggregate->aggregate-> members;713 newType->aggInst->aggregate->aggregate-> members = 0;708 delete newType->aggInst->aggregate->aggregate->fields; 709 newType->aggInst->aggregate->aggregate->fields = 0; 714 710 } // if 715 711 } // if
Note:
See TracChangeset
for help on using the changeset viewer.