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