Changeset cb98d9d for src/Parser/DeclarationNode.cc
- Timestamp:
- Apr 8, 2024, 11:57:37 AM (21 months ago)
- Branches:
- master
- Children:
- 485cf59, dd37afa
- Parents:
- d3a49864 (diff), d9bad51 (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. - File:
-
- 1 edited
-
src/Parser/DeclarationNode.cc (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
rd3a49864 rcb98d9d 53 53 linkage( ::linkage ) { 54 54 55 // variable.name = nullptr;56 55 variable.tyClass = ast::TypeDecl::NUMBER_OF_KINDS; 57 56 variable.assertions = nullptr; … … 65 64 delete name; 66 65 67 // delete variable.name;68 66 delete variable.assertions; 69 67 delete variable.initializer; 70 68 71 //delete type;69 delete type; 72 70 delete bitfieldWidth; 73 71 … … 100 98 newnode->error = error; 101 99 102 // newnode->variable.name = variable.name ? new string( *variable.name ) : nullptr;103 100 newnode->variable.tyClass = variable.tyClass; 104 101 newnode->variable.assertions = maybeCopy( variable.assertions ); … … 228 225 } // DeclarationNode::newEnumValueGeneric 229 226 230 DeclarationNode * DeclarationNode::newEnumInLine( const st ringname ) {231 DeclarationNode * newnode = newName( n ew std::string(name));227 DeclarationNode * DeclarationNode::newEnumInLine( const std::string * name ) { 228 DeclarationNode * newnode = newName( name ); 232 229 newnode->enumInLine = true; 233 230 return newnode; … … 460 457 SemanticWarning( yylloc, Warning::BadQualifiersZeroOne, TypeData::builtinTypeNames[builtin] ); 461 458 } // if 462 type = ::addQualifiers( q->type,type );459 type = ::addQualifiers( type, q->type ); 463 460 q->type = nullptr; 464 461 … … 473 470 copySpecifiers( o, copyattr ); 474 471 if ( o->type ) { 475 type = ::addType( o->type,type, o->attributes );472 type = ::addType( type, o->type, o->attributes ); 476 473 o->type = nullptr; 477 474 } // if … … 584 581 DeclarationNode * DeclarationNode::addAssertions( DeclarationNode * assertions ) { 585 582 if ( variable.tyClass != ast::TypeDecl::NUMBER_OF_KINDS ) { 586 if ( variable.assertions ) { 587 variable.assertions->set_last( assertions ); 588 } else { 589 variable.assertions = assertions; 590 } // if 583 extend( variable.assertions, assertions ); 591 584 return this; 592 585 } // if 593 586 594 587 assert( type ); 595 switch ( type->kind ) { 596 case TypeData::Symbolic: 597 if ( type->symbolic.assertions ) { 598 type->symbolic.assertions->set_last( assertions ); 599 } else { 600 type->symbolic.assertions = assertions; 601 } // if 602 break; 603 default: 604 assert( false ); 605 } // switch 588 assert( TypeData::Symbolic == type->kind ); 589 extend( type->symbolic.assertions, assertions ); 606 590 607 591 return this; … … 688 672 689 673 DeclarationNode * DeclarationNode::addNewPointer( DeclarationNode * p ) { 690 if ( p ) { 691 assert( p->type->kind == TypeData::Pointer || p->type->kind == TypeData::Reference ); 692 if ( type ) { 693 p->type->base = makeNewBase( type ); 694 type = nullptr; 695 } // if 696 delete this; 697 return p; 698 } else { 699 return this; 700 } // if 674 if ( !p ) return this; 675 assert( p->type->kind == TypeData::Pointer || p->type->kind == TypeData::Reference ); 676 if ( type ) { 677 p->type->base = makeNewBase( type ); 678 type = nullptr; 679 } // if 680 delete this; 681 return p; 701 682 } 702 683 703 684 DeclarationNode * DeclarationNode::addNewArray( DeclarationNode * a ) { 704 if ( ! a ) return this;685 if ( !a ) return this; 705 686 assert( a->type->kind == TypeData::Array ); 706 687 if ( type ) { … … 774 755 if ( ret->kind == TypeData::Aggregate ) { 775 756 newnode->attributes.swap( ret->aggregate.attributes ); 776 } // if 757 } // if 777 758 return newnode; 778 759 } // if
Note:
See TracChangeset
for help on using the changeset viewer.