Changeset 19b5d6b for src/Parser/TypeData.cc
- Timestamp:
- Oct 4, 2016, 11:25:00 AM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 40744af8, a7976d79
- Parents:
- 6295081 (diff), 4b1fd2c (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/TypeData.cc (modified) (33 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/TypeData.cc
r6295081 r19b5d6b 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 12 21:11:22201613 // Update Count : 37712 // Last Modified On : Sat Sep 24 11:14:26 2016 13 // Update Count : 415 14 14 // 15 15 … … 24 24 #include "SynTree/Statement.h" 25 25 #include "SynTree/Initializer.h" 26 27 TypeData::TypeData( Kind k ) : kind( k ), base( 0 ), forall( 0 ) { 26 using namespace std; 27 28 TypeData::TypeData( Kind k ) : kind( k ), base( nullptr ), forall( nullptr ) { 28 29 switch ( kind ) { 29 30 case Unknown: … … 37 38 case Array: 38 39 // array = new Array_t; 39 array.dimension = 0;40 array.dimension = nullptr; 40 41 array.isVarLen = false; 41 42 array.isStatic = false; … … 43 44 case Function: 44 45 // function = new Function_t; 45 function.params = 0;46 function.idList = 0;47 function.oldDeclList = 0;48 function.body = 0;46 function.params = nullptr; 47 function.idList = nullptr; 48 function.oldDeclList = nullptr; 49 function.body = nullptr; 49 50 function.hasBody = false; 50 51 function.newStyle = false; … … 52 53 case Aggregate: 53 54 // aggregate = new Aggregate_t; 54 aggregate.params = 0; 55 aggregate.actuals = 0; 56 aggregate.fields = 0; 55 aggregate.name = nullptr; 56 aggregate.params = nullptr; 57 aggregate.actuals = nullptr; 58 aggregate.fields = nullptr; 57 59 break; 58 60 case AggregateInst: 59 61 // aggInst = new AggInst_t; 60 aggInst.aggregate = 0;61 aggInst.params = 0;62 aggInst.aggregate = nullptr; 63 aggInst.params = nullptr; 62 64 break; 63 65 case Enum: 64 66 // enumeration = new Enumeration_t; 65 enumeration.constants = 0; 67 enumeration.name = nullptr; 68 enumeration.constants = nullptr; 66 69 break; 67 70 case Symbolic: 68 71 case SymbolicInst: 69 72 // symbolic = new Symbolic_t; 70 symbolic.params = 0; 71 symbolic.actuals = 0; 72 symbolic.assertions = 0; 73 break; 74 case Variable: 75 // variable = new Variable_t; 76 // variable.tyClass = DeclarationNode::Type; 77 // variable.assertions = 0; 73 symbolic.name = nullptr; 74 symbolic.params = nullptr; 75 symbolic.actuals = nullptr; 76 symbolic.assertions = nullptr; 78 77 break; 79 78 case Tuple: … … 84 83 // typeexpr = new Typeof_t; 85 84 typeexpr = nullptr; 86 break;87 case Attr:88 // attr = new Attr_t;89 // attr.expr = nullptr;90 // attr.type = nullptr;91 85 break; 92 86 case Builtin: … … 121 115 break; 122 116 case Aggregate: 117 delete aggregate.name; 123 118 delete aggregate.params; 124 119 delete aggregate.actuals; … … 132 127 break; 133 128 case Enum: 129 delete enumeration.name; 134 130 delete enumeration.constants; 135 131 // delete enumeration; … … 137 133 case Symbolic: 138 134 case SymbolicInst: 135 delete symbolic.name; 139 136 delete symbolic.params; 140 137 delete symbolic.actuals; … … 142 139 // delete symbolic; 143 140 break; 144 case Variable:145 // delete variable.assertions;146 // delete variable;147 break;148 141 case Tuple: 149 142 // delete tuple->members; … … 153 146 // delete typeexpr->expr; 154 147 delete typeexpr; 155 break;156 case Attr:157 // delete attr.expr;158 // delete attr.type;159 // delete attr;160 148 break; 161 149 case Builtin: … … 197 185 break; 198 186 case Aggregate: 187 newtype->aggregate.name = aggregate.name ? new string( *aggregate.name ) : nullptr; 199 188 newtype->aggregate.params = maybeClone( aggregate.params ); 200 189 newtype->aggregate.actuals = maybeClone( aggregate.actuals ); 201 190 newtype->aggregate.fields = maybeClone( aggregate.fields ); 202 newtype->aggregate.name = aggregate.name;203 191 newtype->aggregate.kind = aggregate.kind; 204 192 newtype->aggregate.body = aggregate.body; … … 209 197 break; 210 198 case Enum: 211 newtype->enumeration.name = enumeration.name ;199 newtype->enumeration.name = enumeration.name ? new string( *enumeration.name ) : nullptr; 212 200 newtype->enumeration.constants = maybeClone( enumeration.constants ); 213 201 break; 214 202 case Symbolic: 215 203 case SymbolicInst: 204 newtype->symbolic.name = symbolic.name ? new string( *symbolic.name ) : nullptr; 216 205 newtype->symbolic.params = maybeClone( symbolic.params ); 217 206 newtype->symbolic.actuals = maybeClone( symbolic.actuals ); 218 207 newtype->symbolic.assertions = maybeClone( symbolic.assertions ); 219 208 newtype->symbolic.isTypedef = symbolic.isTypedef; 220 newtype->symbolic.name = symbolic.name;221 break;222 case Variable:223 assert( false );224 // newtype->variable.assertions = maybeClone( variable.assertions );225 // newtype->variable.name = variable.name;226 // newtype->variable.tyClass = variable.tyClass;227 209 break; 228 210 case Tuple: … … 231 213 case Typeof: 232 214 newtype->typeexpr = maybeClone( typeexpr ); 233 break;234 case Attr:235 assert( false );236 // newtype->attr.expr = maybeClone( attr.expr );237 // newtype->attr.type = maybeClone( attr.type );238 215 break; 239 216 case Builtin: … … 245 222 } // TypeData::clone 246 223 247 void TypeData::print( std::ostream &os, int indent ) const { 248 using std::endl; 249 using std::string; 250 224 void TypeData::print( ostream &os, int indent ) const { 251 225 for ( int i = 0; i < DeclarationNode::NoQualifier; i += 1 ) { 252 226 if ( qualifiers[i] ) os << DeclarationNode::qualifierName[ i ] << ' '; … … 326 300 break; 327 301 case Aggregate: 328 os << DeclarationNode::aggregateName[ aggregate.kind ] << ' ' << aggregate.name << endl;302 os << DeclarationNode::aggregateName[ aggregate.kind ] << ' ' << *aggregate.name << endl; 329 303 if ( aggregate.params ) { 330 304 os << string( indent + 2, ' ' ) << "with type parameters " << endl; … … 363 337 break; 364 338 case SymbolicInst: 365 os << "instance of type " << symbolic.name;339 os << "instance of type " << *symbolic.name; 366 340 if ( symbolic.actuals ) { 367 341 os << " with parameters" << endl; … … 389 363 } // if 390 364 break; 391 case Variable:392 // os << DeclarationNode::typeClassName[ variable.tyClass ] << " variable ";393 // if ( variable.assertions ) {394 // os << endl << string( indent + 2, ' ' ) << "with assertions" << endl;395 // variable.assertions->printList( os, indent + 4 );396 // os << string( indent + 2, ' ' );397 // } // if398 break;399 365 case Tuple: 400 366 os << "tuple "; … … 410 376 } // if 411 377 break; 412 case Attr:413 // os << "attribute type decl " << attr.name << " applied to ";414 // if ( attr.expr ) {415 // attr.expr->print( os, indent + 2 );416 // } // if417 // if ( attr.type ) {418 // attr.type->print( os, indent + 2 );419 // } // if420 break;421 378 case Builtin: 422 379 os << "gcc builtin type"; … … 428 385 } // TypeData::print 429 386 430 void buildForall( const DeclarationNode * firstNode, std::list< TypeDecl* > &outputList ) {387 void buildForall( const DeclarationNode * firstNode, list< TypeDecl* > &outputList ) { 431 388 buildList( firstNode, outputList ); 432 for ( std::list< TypeDecl* >::iterator i = outputList.begin(); i != outputList.end(); ++i ) {389 for ( list< TypeDecl* >::iterator i = outputList.begin(); i != outputList.end(); ++i ) { 433 390 if ( (*i)->get_kind() == TypeDecl::Any ) { 434 391 // add assertion parameters to `type' tyvars in reverse order 435 392 // add dtor: void ^?{}(T *) 436 393 FunctionType * dtorType = new FunctionType( Type::Qualifiers(), false ); 437 dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0) );438 (*i)->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, dtorType, 0, false, false ) );394 dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) ); 395 (*i)->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, dtorType, nullptr, false, false ) ); 439 396 440 397 // add copy ctor: void ?{}(T *, T) 441 398 FunctionType * copyCtorType = new FunctionType( Type::Qualifiers(), false ); 442 copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0) );443 copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), 0) );444 (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, copyCtorType, 0, false, false ) );399 copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) ); 400 copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), nullptr ) ); 401 (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, copyCtorType, nullptr, false, false ) ); 445 402 446 403 // add default ctor: void ?{}(T *) 447 404 FunctionType * ctorType = new FunctionType( Type::Qualifiers(), false ); 448 ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0) );449 (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, ctorType, 0, false, false ) );405 ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) ); 406 (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, ctorType, nullptr, false, false ) ); 450 407 451 408 // add assignment operator: T * ?=?(T *, T) 452 409 FunctionType * assignType = new FunctionType( Type::Qualifiers(), false ); 453 assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0) );454 assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), 0) );455 assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), 0) );456 (*i)->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, 0, false, false ) );410 assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) ); 411 assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), nullptr ) ); 412 assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), nullptr ) ); 413 (*i)->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, nullptr, false, false ) ); 457 414 } // if 458 415 } // for … … 486 443 case TypeData::Builtin: 487 444 return new VarArgsType( buildQualifiers( td ) ); 488 case TypeData::Attr:489 assert( false );490 return buildAttr( td );491 445 case TypeData::Symbolic: 492 446 case TypeData::Enum: 493 447 case TypeData::Aggregate: 494 case TypeData::Variable:495 448 assert( false ); 496 449 } // switch 497 return 0;450 return nullptr; 498 451 } // typebuild 499 452 500 453 TypeData * typeextractAggregate( const TypeData * td, bool toplevel ) { 501 TypeData * ret = 0;454 TypeData * ret = nullptr; 502 455 503 456 switch ( td->kind ) { … … 549 502 case DeclarationNode::Bool: 550 503 if ( td->signedness != DeclarationNode::NoSignedness ) { 551 throw SemanticError( st d::string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td );504 throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td ); 552 505 } // if 553 506 if ( td->length != DeclarationNode::NoLength ) { 554 throw SemanticError( st d::string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );507 throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td ); 555 508 } // if 556 509 … … 565 518 566 519 if ( td->length != DeclarationNode::NoLength ) { 567 throw SemanticError( st d::string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );520 throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td ); 568 521 } // if 569 522 … … 595 548 FloatingPoint: ; 596 549 if ( td->signedness != DeclarationNode::NoSignedness ) { 597 throw SemanticError( st d::string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td );550 throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td ); 598 551 } // if 599 552 if ( td->length == DeclarationNode::Short || td->length == DeclarationNode::LongLong ) { 600 throw SemanticError( st d::string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );553 throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td ); 601 554 } // if 602 555 if ( td->basictype == DeclarationNode::Float && td->length == DeclarationNode::Long ) { … … 655 608 switch ( td->aggregate.kind ) { 656 609 case DeclarationNode::Struct: 657 at = new StructDecl( td->aggregate.name );610 at = new StructDecl( *td->aggregate.name ); 658 611 buildForall( td->aggregate.params, at->get_parameters() ); 659 612 break; 660 613 case DeclarationNode::Union: 661 at = new UnionDecl( td->aggregate.name );614 at = new UnionDecl( *td->aggregate.name ); 662 615 buildForall( td->aggregate.params, at->get_parameters() ); 663 616 break; 664 617 case DeclarationNode::Trait: 665 at = new TraitDecl( td->aggregate.name );618 at = new TraitDecl( *td->aggregate.name ); 666 619 buildList( td->aggregate.params, at->get_parameters() ); 667 620 break; … … 681 634 ReferenceToType * ret; 682 635 if ( td->aggInst.aggregate->kind == TypeData::Enum ) { 683 ret = new EnumInstType( buildQualifiers( td ), td->aggInst.aggregate->enumeration.name );636 ret = new EnumInstType( buildQualifiers( td ), *td->aggInst.aggregate->enumeration.name ); 684 637 } else { 685 638 assert( td->aggInst.aggregate->kind == TypeData::Aggregate ); 686 639 switch ( td->aggInst.aggregate->aggregate.kind ) { 687 640 case DeclarationNode::Struct: 688 ret = new StructInstType( buildQualifiers( td ), td->aggInst.aggregate->aggregate.name ); 641 assert( td->aggInst.aggregate->aggregate.name ); 642 ret = new StructInstType( buildQualifiers( td ), *td->aggInst.aggregate->aggregate.name ); 689 643 break; 690 644 case DeclarationNode::Union: 691 ret = new UnionInstType( buildQualifiers( td ), td->aggInst.aggregate->aggregate.name );645 ret = new UnionInstType( buildQualifiers( td ), *td->aggInst.aggregate->aggregate.name ); 692 646 break; 693 647 case DeclarationNode::Trait: 694 ret = new TraitInstType( buildQualifiers( td ), td->aggInst.aggregate->aggregate.name );648 ret = new TraitInstType( buildQualifiers( td ), *td->aggInst.aggregate->aggregate.name ); 695 649 break; 696 650 default: … … 703 657 } // buildAggInst 704 658 705 NamedTypeDecl * buildSymbolic( const TypeData * td, const st d::string & name, DeclarationNode::StorageClass sc ) {659 NamedTypeDecl * buildSymbolic( const TypeData * td, const string & name, DeclarationNode::StorageClass sc ) { 706 660 assert( td->kind == TypeData::Symbolic ); 707 661 NamedTypeDecl * ret; … … 717 671 } // buildSymbolic 718 672 719 TypeDecl * buildVariable( const TypeData * td ) {720 assert( false );721 return nullptr;722 // assert( td->kind == TypeData::Variable );723 // static const TypeDecl::Kind kindMap[] = { TypeDecl::Any, TypeDecl::Ftype, TypeDecl::Dtype };724 725 // TypeDecl * ret = new TypeDecl( td->variable.name, DeclarationNode::NoStorageClass, 0, kindMap[ td->variable.tyClass ] );726 // buildList( td->variable.assertions, ret->get_assertions() );727 // return ret;728 } // buildSymbolic729 730 673 EnumDecl * buildEnum( const TypeData * td ) { 731 674 assert( td->kind == TypeData::Enum ); 732 EnumDecl * ret = new EnumDecl( td->enumeration.name );675 EnumDecl * ret = new EnumDecl( *td->enumeration.name ); 733 676 buildList( td->enumeration.constants, ret->get_members() ); 734 std::list< Declaration * >::iterator members = ret->get_members().begin();677 list< Declaration * >::iterator members = ret->get_members().begin(); 735 678 for ( const DeclarationNode * cur = td->enumeration. constants; cur != nullptr; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ), ++members ) { 736 679 if ( cur->has_enumeratorValue() ) { 737 680 ObjectDecl * member = dynamic_cast< ObjectDecl * >(* members); 738 member->set_init( new SingleInit( maybeMoveBuild< Expression >( cur->consume_enumeratorValue() ), std::list< Expression * >() ) );681 member->set_init( new SingleInit( maybeMoveBuild< Expression >( cur->consume_enumeratorValue() ), list< Expression * >() ) ); 739 682 } // if 740 683 } // for … … 744 687 TypeInstType * buildSymbolicInst( const TypeData * td ) { 745 688 assert( td->kind == TypeData::SymbolicInst ); 746 TypeInstType * ret = new TypeInstType( buildQualifiers( td ), td->symbolic.name, false );689 TypeInstType * ret = new TypeInstType( buildQualifiers( td ), *td->symbolic.name, false ); 747 690 buildList( td->symbolic.actuals, ret->get_parameters() ); 748 691 buildForall( td->forall, ret->get_forall() ); … … 765 708 } // buildTypeof 766 709 767 AttrType * buildAttr( const TypeData * td ) { 768 assert( false ); 769 return nullptr; 770 // assert( td->kind == TypeData::Attr ); 771 // // assert( td->attr ); 772 // AttrType * ret; 773 // if ( td->attr.expr ) { 774 // ret = new AttrType( buildQualifiers( td ), td->attr.name, td->attr.expr->build() ); 775 // } else { 776 // assert( td->attr.type ); 777 // ret = new AttrType( buildQualifiers( td ), td->attr.name, td->attr.type->buildType() ); 778 // } // if 779 // return ret; 780 } // buildAttr 781 782 Declaration * buildDecl( const TypeData * td, std::string name, DeclarationNode::StorageClass sc, Expression * bitfieldWidth, bool isInline, bool isNoreturn, LinkageSpec::Spec linkage, Initializer * init ) { 710 Declaration * buildDecl( const TypeData * td, const string &name, DeclarationNode::StorageClass sc, Expression * bitfieldWidth, bool isInline, bool isNoreturn, LinkageSpec::Spec linkage, Initializer * init ) { 783 711 if ( td->kind == TypeData::Function ) { 784 712 FunctionDecl * decl; … … 790 718 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), body, isInline, isNoreturn ); 791 719 } else { 792 // std::list< Label > ls;793 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), new CompoundStmt( std::list< Label >() ), isInline, isNoreturn );720 // list< Label > ls; 721 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), new CompoundStmt( list< Label >() ), isInline, isNoreturn ); 794 722 } // if 795 723 } else { 796 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), 0, isInline, isNoreturn );797 } // if 798 for ( DeclarationNode * cur = td->function.idList; cur != 0; cur = dynamic_cast< DeclarationNode* >( cur->get_next() ) ) {799 if ( cur-> get_name() != "") {800 decl->get_oldIdents().insert( decl->get_oldIdents().end(), cur->get_name());724 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), nullptr, isInline, isNoreturn ); 725 } // if 726 for ( DeclarationNode * cur = td->function.idList; cur != nullptr; cur = dynamic_cast< DeclarationNode* >( cur->get_next() ) ) { 727 if ( cur->name ) { 728 decl->get_oldIdents().insert( decl->get_oldIdents().end(), *cur->name ); 801 729 } // if 802 730 } // for … … 809 737 } else if ( td->kind == TypeData::Symbolic ) { 810 738 return buildSymbolic( td, name, sc ); 811 } else if ( td->kind == TypeData::Variable ) {812 assert( false );813 return buildVariable( td );814 739 } else { 815 return new ObjectDecl( name, sc, linkage, bitfieldWidth, typebuild( td ), init, std::list< Attribute * >(), isInline, isNoreturn );740 return new ObjectDecl( name, sc, linkage, bitfieldWidth, typebuild( td ), init, list< Attribute * >(), isInline, isNoreturn ); 816 741 } // if 817 return 0;742 return nullptr; 818 743 } // buildDecl 819 744 … … 831 756 break; 832 757 default: 833 ft->get_returnVals().push_back( dynamic_cast< DeclarationWithType* >( buildDecl( td->base, "", DeclarationNode::NoStorageClass, 0, false, false, LinkageSpec::Cforall ) ) );758 ft->get_returnVals().push_back( dynamic_cast< DeclarationWithType* >( buildDecl( td->base, "", DeclarationNode::NoStorageClass, nullptr, false, false, LinkageSpec::Cforall ) ) ); 834 759 } // switch 835 760 } else { 836 ft->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), 0) );761 ft->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) ); 837 762 } // if 838 763 return ft;
Note:
See TracChangeset
for help on using the changeset viewer.