Ignore:
Timestamp:
Jun 24, 2015, 4:04:19 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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
Message:

fix computed goto, fixed -std=, implicit typedefs for enum and aggregates, add _Noreturn _Thread_local

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TypeData.cc

    ra1d5d2a rde62360d  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun 13 08:03:20 2015
    13 // Update Count     : 15
     12// Last Modified On : Thu Jun 18 22:06:23 2015
     13// Update Count     : 21
    1414//
    1515
     
    437437                        assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), 0 ) );
    438438                        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 ) );
    440440                } // if
    441441        } // for
    442442}
    443443
    444 Declaration *TypeData::buildDecl( std::string name, DeclarationNode::StorageClass sc, Expression *bitfieldWidth, bool isInline, LinkageSpec::Type linkage, Initializer *init ) const {
     444Declaration *TypeData::buildDecl( std::string name, DeclarationNode::StorageClass sc, Expression *bitfieldWidth, bool isInline, bool isNoreturn, LinkageSpec::Type linkage, Initializer *init ) const {
    445445        if ( kind == TypeData::Function ) {
    446446                FunctionDecl *decl;
     
    450450                                CompoundStmt *body = dynamic_cast< CompoundStmt* >( stmt );
    451451                                assert( body );
    452                                 decl = new FunctionDecl( name, sc, linkage, buildFunction(), body, isInline );
     452                                decl = new FunctionDecl( name, sc, linkage, buildFunction(), body, isInline, isNoreturn );
    453453                        } else {
    454454                                // 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 );
    456456                        } // if
    457457                } else {
    458                         decl = new FunctionDecl( name, sc, linkage, buildFunction(), 0, isInline );
     458                        decl = new FunctionDecl( name, sc, linkage, buildFunction(), 0, isInline, isNoreturn );
    459459                } // if
    460460                for ( DeclarationNode *cur = function->idList; cur != 0; cur = dynamic_cast< DeclarationNode* >( cur->get_link() ) ) {
     
    474474                return buildVariable();
    475475        } 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 );
    478478                } else {
    479479                        return new ObjectDecl( name, sc, linkage, bitfieldWidth, build(), init );
     
    598598                                } // if
    599599                                break;
    600        
    601600                          case DeclarationNode::Complex:
    602601                                switch ( ret ) {
     
    791790                        break;
    792791                  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 ) ) );
    794793                } // switch
    795794        } else {
     
    806805                at = new StructDecl( aggregate->name );
    807806                break;
    808        
    809807          case DeclarationNode::Union:
    810808                at = new UnionDecl( aggregate->name );
    811809                break;
    812        
    813810          case DeclarationNode::Context:
    814811                at = new ContextDecl( aggregate->name );
    815812                break;
    816        
    817813          default:
    818814                assert( false );
     
    838834ReferenceToType *TypeData::buildAggInst() const {
    839835        assert( kind == AggregateInst );
    840         std::string name;
    841836
    842837        ReferenceToType *ret;
     
    883878        TypeDecl *ret = new TypeDecl( variable->name, DeclarationNode::NoStorageClass, 0, kindMap[ variable->tyClass ] );
    884879        buildList( variable->assertions, ret->get_assertions() );
    885        
    886880        return ret;
    887881}
     
    891885        EnumDecl *ret = new EnumDecl( enumeration->name );
    892886        buildList( enumeration->constants, ret->get_members() );
    893 
    894887        return ret;
    895888}
     
    900893        buildList( symbolic->actuals, ret->get_parameters() );
    901894        buildForall( forall, ret->get_forall() );
    902 
    903895        return ret;
    904896}
     
    909901        buildTypeList( tuple->members, ret->get_types() );
    910902        buildForall( forall, ret->get_forall() );
    911 
    912903        return ret;
    913904}
     
    918909        assert( typeexpr->expr );
    919910        TypeofType *ret = new TypeofType( buildQualifiers(), typeexpr->expr->build() );
    920 
    921911        return ret;
    922912}
     
    932922                ret = new AttrType( buildQualifiers(), attr->name, attr->type->buildType() );
    933923        } // if
    934 
    935924        return ret;
    936925}
Note: See TracChangeset for help on using the changeset viewer.