Changes in src/Parser/DeclarationNode.cc [2871210:de62360d]
- File:
-
- 1 edited
-
src/Parser/DeclarationNode.cc (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r2871210 rde62360d 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 3 12:35:02201513 // Update Count : 10812 // Last Modified On : Wed Jun 24 15:29:19 2015 13 // Update Count : 86 14 14 // 15 15 … … 173 173 } 174 174 175 DeclarationNode *DeclarationNode::newAggregate( Aggregate kind, const std::string *name, ExpressionNode *actuals, DeclarationNode *fields ) {175 DeclarationNode *DeclarationNode::newAggregate( Aggregate kind, std::string *name, DeclarationNode *formals, 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 == "" ) { // anonymous aggregate ?180 if ( newnode->type->aggregate->name == "" ) { 181 181 newnode->type->aggregate->name = DeclarationNode::anonymous.newName(); 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 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; 190 192 newnode->type->aggregate->actuals = actuals; 191 newnode->type->aggregate-> fields = fields;193 newnode->type->aggregate->members = fields; 192 194 return newnode; 193 195 } … … 198 200 newnode->type = new TypeData( TypeData::Enum ); 199 201 newnode->type->enumeration->name = newnode->name; 200 if ( newnode->type->enumeration->name == "" ) { // anonymous enumeration ?202 if ( newnode->type->enumeration->name == "" ) { 201 203 newnode->type->enumeration->name = DeclarationNode::anonymous.newName(); 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 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 210 213 newnode->type->enumeration->constants = constants; 211 214 return newnode; … … 248 251 newnode->type->aggregate->kind = Context; 249 252 newnode->type->aggregate->params = params; 250 newnode->type->aggregate-> fields = asserts;253 newnode->type->aggregate->members = asserts; 251 254 newnode->type->aggregate->name = assign_strptr( name ); 252 255 return newnode; … … 368 371 if ( type->kind == TypeData::Aggregate ) { 369 372 type->aggregate->params = q->type->forall; 370 // change implicit typedef from TYPEDEFname to TYPEGENname371 typedefTable.changeKind( type->aggregate->name, TypedefTable::TG );372 373 } else { 373 374 type->forall = q->type->forall; … … 406 407 src = 0; 407 408 break; 409 408 410 case TypeData::Basic: 409 411 dst->qualifiers.splice( dst->qualifiers.end(), src->qualifiers ); … … 414 416 } // if 415 417 break; 418 416 419 default: 417 420 switch ( src->kind ) { … … 426 429 src = 0; 427 430 break; 431 428 432 default: 429 433 if ( dst->forall ) { … … 680 684 } else { 681 685 assert( newnode->type->aggInst->aggregate->kind == TypeData::Aggregate ); 682 delete newnode->type->aggInst->aggregate->aggregate-> fields;683 newnode->type->aggInst->aggregate->aggregate-> fields = 0;686 delete newnode->type->aggInst->aggregate->aggregate->members; 687 newnode->type->aggInst->aggregate->aggregate->members = 0; 684 688 } // if 685 689 } // if … … 706 710 } else { 707 711 assert( newType->aggInst->aggregate->kind == TypeData::Aggregate ); 708 delete newType->aggInst->aggregate->aggregate-> fields;709 newType->aggInst->aggregate->aggregate-> fields = 0;712 delete newType->aggInst->aggregate->aggregate->members; 713 newType->aggInst->aggregate->aggregate->members = 0; 710 714 } // if 711 715 } // if
Note:
See TracChangeset
for help on using the changeset viewer.