Changeset de62360d for src/Parser/TypeData.cc
- Timestamp:
- Jun 24, 2015, 4:04:19 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 94e0864d
- Parents:
- a1d5d2a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/TypeData.cc
ra1d5d2a rde62360d 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jun 13 08:03:20201513 // Update Count : 1512 // Last Modified On : Thu Jun 18 22:06:23 2015 13 // Update Count : 21 14 14 // 15 15 … … 437 437 assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), 0 ) ); 438 438 assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), 0 ) ); 439 (*i)->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, 0, false ) );439 (*i)->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, 0, false, false ) ); 440 440 } // if 441 441 } // for 442 442 } 443 443 444 Declaration *TypeData::buildDecl( std::string name, DeclarationNode::StorageClass sc, Expression *bitfieldWidth, bool isInline, LinkageSpec::Type linkage, Initializer *init ) const {444 Declaration *TypeData::buildDecl( std::string name, DeclarationNode::StorageClass sc, Expression *bitfieldWidth, bool isInline, bool isNoreturn, LinkageSpec::Type linkage, Initializer *init ) const { 445 445 if ( kind == TypeData::Function ) { 446 446 FunctionDecl *decl; … … 450 450 CompoundStmt *body = dynamic_cast< CompoundStmt* >( stmt ); 451 451 assert( body ); 452 decl = new FunctionDecl( name, sc, linkage, buildFunction(), body, isInline );452 decl = new FunctionDecl( name, sc, linkage, buildFunction(), body, isInline, isNoreturn ); 453 453 } else { 454 454 // std::list<Label> ls; 455 decl = new FunctionDecl( name, sc, linkage, buildFunction(), new CompoundStmt( std::list<Label>() ), isInline );455 decl = new FunctionDecl( name, sc, linkage, buildFunction(), new CompoundStmt( std::list<Label>() ), isInline, isNoreturn ); 456 456 } // if 457 457 } else { 458 decl = new FunctionDecl( name, sc, linkage, buildFunction(), 0, isInline );458 decl = new FunctionDecl( name, sc, linkage, buildFunction(), 0, isInline, isNoreturn ); 459 459 } // if 460 460 for ( DeclarationNode *cur = function->idList; cur != 0; cur = dynamic_cast< DeclarationNode* >( cur->get_link() ) ) { … … 474 474 return buildVariable(); 475 475 } else { 476 if ( isInline ) {477 throw SemanticError( "invalid inline specification in declaration of ", this );476 if ( isInline || isNoreturn ) { 477 throw SemanticError( "invalid inline or _Noreturn specification in declaration of ", this ); 478 478 } else { 479 479 return new ObjectDecl( name, sc, linkage, bitfieldWidth, build(), init ); … … 598 598 } // if 599 599 break; 600 601 600 case DeclarationNode::Complex: 602 601 switch ( ret ) { … … 791 790 break; 792 791 default: 793 ft->get_returnVals().push_back( dynamic_cast< DeclarationWithType* >( base->buildDecl( "", DeclarationNode::NoStorageClass, 0, false, LinkageSpec::Cforall ) ) );792 ft->get_returnVals().push_back( dynamic_cast< DeclarationWithType* >( base->buildDecl( "", DeclarationNode::NoStorageClass, 0, false, false, LinkageSpec::Cforall ) ) ); 794 793 } // switch 795 794 } else { … … 806 805 at = new StructDecl( aggregate->name ); 807 806 break; 808 809 807 case DeclarationNode::Union: 810 808 at = new UnionDecl( aggregate->name ); 811 809 break; 812 813 810 case DeclarationNode::Context: 814 811 at = new ContextDecl( aggregate->name ); 815 812 break; 816 817 813 default: 818 814 assert( false ); … … 838 834 ReferenceToType *TypeData::buildAggInst() const { 839 835 assert( kind == AggregateInst ); 840 std::string name;841 836 842 837 ReferenceToType *ret; … … 883 878 TypeDecl *ret = new TypeDecl( variable->name, DeclarationNode::NoStorageClass, 0, kindMap[ variable->tyClass ] ); 884 879 buildList( variable->assertions, ret->get_assertions() ); 885 886 880 return ret; 887 881 } … … 891 885 EnumDecl *ret = new EnumDecl( enumeration->name ); 892 886 buildList( enumeration->constants, ret->get_members() ); 893 894 887 return ret; 895 888 } … … 900 893 buildList( symbolic->actuals, ret->get_parameters() ); 901 894 buildForall( forall, ret->get_forall() ); 902 903 895 return ret; 904 896 } … … 909 901 buildTypeList( tuple->members, ret->get_types() ); 910 902 buildForall( forall, ret->get_forall() ); 911 912 903 return ret; 913 904 } … … 918 909 assert( typeexpr->expr ); 919 910 TypeofType *ret = new TypeofType( buildQualifiers(), typeexpr->expr->build() ); 920 921 911 return ret; 922 912 } … … 932 922 ret = new AttrType( buildQualifiers(), attr->name, attr->type->buildType() ); 933 923 } // if 934 935 924 return ret; 936 925 }
Note: See TracChangeset
for help on using the changeset viewer.