Changeset 409433da


Ignore:
Timestamp:
Mar 17, 2017, 5:34:05 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
89d129c
Parents:
615a096
Message:

support coroutine, monitor, thread as kind of structure

Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r615a096 r409433da  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 08:46:05 2017
    13 // Update Count     : 1017
     12// Last Modified On : Fri Mar 17 15:46:33 2017
     13// Update Count     : 1018
    1414//
    1515
     
    3636const char * DeclarationNode::signednessNames[] = { "signed", "unsigned", "NoSignednessNames" };
    3737const char * DeclarationNode::lengthNames[] = { "short", "long", "long long", "NoLengthNames" };
    38 const char * DeclarationNode::aggregateNames[] = { "struct", "union", "context", "NoAggregateNames" };
     38const char * DeclarationNode::aggregateNames[] = { "struct", "union", "trait", "coroutine", "monitor", "thread", "NoAggregateNames" };
    3939const char * DeclarationNode::typeClassNames[] = { "otype", "dtype", "ftype", "NoTypeClassNames" };
    4040const char * DeclarationNode::builtinTypeNames[] = { "__builtin_va_list", "NoBuiltinTypeNames" };
  • src/Parser/ParseNode.h

    r615a096 r409433da  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 08:32:43 2017
    13 // Update Count     : 776
     12// Last Modified On : Fri Mar 17 15:42:18 2017
     13// Update Count     : 777
    1414//
    1515
     
    205205        enum Signedness { Signed, Unsigned, NoSignedness };
    206206        enum Length { Short, Long, LongLong, NoLength };
    207         enum Aggregate { Struct, Union, Trait, NoAggregate };
     207        enum Aggregate { Struct, Union, Trait, Coroutine, Monitor, Thread, NoAggregate };
    208208        enum TypeClass { Otype, Dtype, Ftype, Ttype, NoTypeClass };
    209209        enum BuiltinType { Valist, Zero, One, NoBuiltinType };
  • src/Parser/TypeData.cc

    r615a096 r409433da  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 08:46:10 2017
    13 // Update Count     : 560
     12// Last Modified On : Fri Mar 17 15:52:43 2017
     13// Update Count     : 563
    1414//
    1515
     
    619619        switch ( td->aggregate.kind ) {
    620620          case DeclarationNode::Struct:
    621                 at = new StructDecl( *td->aggregate.name, attributes );
     621          case DeclarationNode::Coroutine:
     622          case DeclarationNode::Monitor:
     623          case DeclarationNode::Thread:
     624                at = new StructDecl( *td->aggregate.name, td->aggregate.kind, attributes );
    622625                buildForall( td->aggregate.params, at->get_parameters() );
    623626                break;
     
    656659                          switch ( type->aggregate.kind ) {
    657660                                case DeclarationNode::Struct:
     661                                case DeclarationNode::Coroutine:
     662                                case DeclarationNode::Monitor:
     663                                case DeclarationNode::Thread:
    658664                                  ret = new StructInstType( buildQualifiers( type ), (StructDecl *)typedecl );
    659665                                  break;
     
    671677                          switch ( type->aggregate.kind ) {
    672678                                case DeclarationNode::Struct:
     679                                case DeclarationNode::Coroutine:
     680                                case DeclarationNode::Monitor:
     681                                case DeclarationNode::Thread:
    673682                                  ret = new StructInstType( buildQualifiers( type ), *type->aggregate.name );
    674683                                  break;
     
    703712                  switch ( type->aggregate.kind ) {
    704713                        case DeclarationNode::Struct:
     714                        case DeclarationNode::Coroutine:
     715                        case DeclarationNode::Monitor:
     716                        case DeclarationNode::Thread:
    705717                          ret = new StructInstType( buildQualifiers( type ), *type->aggregate.name );
    706718                          break;
  • src/Parser/parser.yy

    r615a096 r409433da  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 12:57:03 2017
    13 // Update Count     : 2316
     12// Last Modified On : Fri Mar 17 15:42:22 2017
     13// Update Count     : 2317
    1414//
    1515
     
    16381638                { $$ = DeclarationNode::Union; }
    16391639        | COROUTINE
    1640                 { $$ = DeclarationNode::Struct; }
     1640                { $$ = DeclarationNode::Coroutine; }
    16411641        | MONITOR
    1642                 { $$ = DeclarationNode::Struct; }
     1642                { $$ = DeclarationNode::Monitor; }
    16431643        | THREAD
    1644                 { $$ = DeclarationNode::Struct; }
     1644                { $$ = DeclarationNode::Thread; }
    16451645        ;
    16461646
  • src/SynTree/Declaration.h

    r615a096 r409433da  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 08:34:11 2017
    13 // Update Count     : 118
     12// Last Modified On : Fri Mar 17 16:05:08 2017
     13// Update Count     : 121
    1414//
    1515
     
    255255        typedef AggregateDecl Parent;
    256256  public:
    257         StructDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ) {}
     257        StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ), kind( kind ) {}
    258258        StructDecl( const StructDecl &other ) : Parent( other ) {}
    259259
     260        bool is_coroutine() { return kind == DeclarationNode::Coroutine; }
     261        bool is_monitor() { return kind == DeclarationNode::Monitor; }
     262        bool is_thread() { return kind == DeclarationNode::Thread; }
     263
    260264        virtual StructDecl *clone() const { return new StructDecl( *this ); }
    261265        virtual void accept( Visitor &v ) { v.visit( this ); }
    262266        virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    263267  private:
     268        DeclarationNode::Aggregate kind;
    264269        virtual std::string typeString() const;
    265270};
Note: See TracChangeset for help on using the changeset viewer.