Changes in src/SymTab/Autogen.cc [a16764a6:bd06384]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Autogen.cc
ra16764a6 rbd06384 214 214 void addForwardDecl( FunctionDecl * functionDecl, std::list< Declaration * > & declsToAdd ) { 215 215 FunctionDecl * decl = functionDecl->clone(); 216 delete decl->statements;217 216 decl->statements = nullptr; 218 217 declsToAdd.push_back( decl ); … … 333 332 } catch ( SemanticErrorException err ) { 334 333 // okay if decl does not resolve - that means the function should not be generated 335 delete dcl;336 334 } 337 335 } … … 373 371 // do not carry over field's attributes to parameter type 374 372 Type * paramType = field->get_type()->clone(); 375 deleteAll( paramType->attributes );376 373 paramType->attributes.clear(); 377 374 // add a parameter corresponding to this field … … 383 380 resolve( ctor ); 384 381 } 385 delete memCtorType;386 382 } 387 383 … … 511 507 // do not carry over field's attributes to parameter type 512 508 Type * paramType = field->get_type()->clone(); 513 deleteAll( paramType->attributes );514 509 paramType->attributes.clear(); 515 510 // add a parameter corresponding to this field … … 524 519 break; 525 520 } 526 delete memCtorType;527 521 } 528 522 … … 594 588 // must visit children (enum constants) to add them to the indexer 595 589 if ( enumDecl->has_body() ) { 596 EnumInstType enumInst( Type::Qualifiers(), enumDecl->get_name() );597 enumInst .set_baseEnum( enumDecl );598 EnumFuncGenerator gen( &enumInst, data, functionNesting, indexer );590 auto enumInst = new EnumInstType{ Type::Qualifiers(), enumDecl->get_name() }; 591 enumInst->set_baseEnum( enumDecl ); 592 EnumFuncGenerator gen( enumInst, data, functionNesting, indexer ); 599 593 generateFunctions( gen, declsToAddAfter ); 600 594 } … … 604 598 visit_children = false; 605 599 if ( structDecl->has_body() ) { 606 StructInstType structInst( Type::Qualifiers(), structDecl->name );607 structInst .set_baseStruct( structDecl );600 auto structInst = new StructInstType{ Type::Qualifiers(), structDecl->name }; 601 structInst->set_baseStruct( structDecl ); 608 602 for ( TypeDecl * typeDecl : structDecl->parameters ) { 609 structInst .parameters.push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->name, typeDecl ) ) );610 } 611 StructFuncGenerator gen( structDecl, &structInst, data, functionNesting, indexer );603 structInst->parameters.push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->name, typeDecl ) ) ); 604 } 605 StructFuncGenerator gen( structDecl, structInst, data, functionNesting, indexer ); 612 606 generateFunctions( gen, declsToAddAfter ); 613 607 } // if … … 617 611 visit_children = false; 618 612 if ( unionDecl->has_body() ) { 619 UnionInstType unionInst( Type::Qualifiers(), unionDecl->get_name() );620 unionInst .set_baseUnion( unionDecl );613 auto unionInst = new UnionInstType{ Type::Qualifiers(), unionDecl->get_name() }; 614 unionInst->set_baseUnion( unionDecl ); 621 615 for ( TypeDecl * typeDecl : unionDecl->get_parameters() ) { 622 unionInst .get_parameters().push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), typeDecl ) ) );623 } 624 UnionFuncGenerator gen( unionDecl, &unionInst, data, functionNesting, indexer );616 unionInst->get_parameters().push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), typeDecl ) ) ); 617 } 618 UnionFuncGenerator gen( unionDecl, unionInst, data, functionNesting, indexer ); 625 619 generateFunctions( gen, declsToAddAfter ); 626 620 } // if … … 631 625 if ( ! typeDecl->base ) return; 632 626 633 TypeInstType refType( Type::Qualifiers(), typeDecl->name, typeDecl );634 TypeFuncGenerator gen( typeDecl, &refType, data, functionNesting, indexer );627 auto refType = new TypeInstType{ Type::Qualifiers(), typeDecl->name, typeDecl }; 628 TypeFuncGenerator gen( typeDecl, refType, data, functionNesting, indexer ); 635 629 generateFunctions( gen, declsToAddAfter ); 636 630
Note:
See TracChangeset
for help on using the changeset viewer.