Changeset a7c90d4 for src/SynTree


Ignore:
Timestamp:
Mar 7, 2017, 8:33:43 AM (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:
64cb860, c3396e0
Parents:
7fe2498
Message:

change StorageClass? to bitset, support _Thread_local as separate storage-class

Location:
src/SynTree
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/SynTree/AggregateDecl.cc

    r7fe2498 ra7c90d4  
    1010// Created On       : Sun May 17 23:56:39 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Feb  6 15:31:23 2017
    13 // Update Count     : 17
     12// Last Modified On : Tue Mar  7 07:31:47 2017
     13// Update Count     : 19
    1414//
    1515
     
    2020
    2121
    22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, DeclarationNode::NoStorageClass, LinkageSpec::Cforall ), body( false ), attributes( attributes ) {
     22AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, DeclarationNode::StorageClasses(), LinkageSpec::Cforall ), body( false ), attributes( attributes ) {
    2323}
    2424
  • TabularUnified src/SynTree/Declaration.cc

    r7fe2498 ra7c90d4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  1 20:11:57 2017
    13 // Update Count     : 17
     12// Last Modified On : Tue Mar  7 07:31:11 2017
     13// Update Count     : 23
    1414//
    1515
     
    2727static IdMapType idMap;
    2828
    29 Declaration::Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage )
    30                 : name( name ), storageClass( sc ), linkage( linkage ), uniqueId( 0 ) {
     29Declaration::Declaration( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage )
     30                : name( name ), storageClasses( scs ), linkage( linkage ), uniqueId( 0 ) {
    3131}
    3232
    3333Declaration::Declaration( const Declaration &other )
    34         : name( other.name ), storageClass( other.storageClass ), linkage( other.linkage ), uniqueId( other.uniqueId ) {
     34        : name( other.name ), storageClasses( other.storageClasses ), linkage( other.linkage ), uniqueId( other.uniqueId ) {
    3535}
    3636
     
    6666
    6767
    68 AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", DeclarationNode::NoStorageClass, LinkageSpec::C ), stmt( stmt ) {
     68AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", DeclarationNode::StorageClasses(), LinkageSpec::C ), stmt( stmt ) {
    6969}
    7070
  • TabularUnified src/SynTree/Declaration.h

    r7fe2498 ra7c90d4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar  3 20:59:27 2017
    13 // Update Count     : 96
     12// Last Modified On : Tue Mar  7 07:40:42 2017
     13// Update Count     : 113
    1414//
    1515
     
    2828class Declaration : public BaseSyntaxNode {
    2929  public:
    30         Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage );
     30        Declaration( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage );
    3131        Declaration( const Declaration &other );
    3232        virtual ~Declaration();
     
    3434        const std::string &get_name() const { return name; }
    3535        void set_name( std::string newValue ) { name = newValue; }
    36         DeclarationNode::StorageClass get_storageClass() const { return storageClass; }
    37         void set_storageClass( DeclarationNode::StorageClass newValue ) { storageClass = newValue; }
     36
     37        DeclarationNode::StorageClasses get_storageClasses() const { return storageClasses; }
     38
    3839        LinkageSpec::Spec get_linkage() const { return linkage; }
    3940        void set_linkage( LinkageSpec::Spec newValue ) { linkage = newValue; }
     41
    4042        UniqueId get_uniqueId() const { return uniqueId; }
     43
    4144        bool get_extension() const { return extension; }
    4245        Declaration *set_extension( bool exten ) { extension = exten; return this; }
     
    5356  private:
    5457        std::string name;
    55         DeclarationNode::StorageClass storageClass;
     58        DeclarationNode::StorageClasses storageClasses;
    5659        LinkageSpec::Spec linkage;
    5760        UniqueId uniqueId;
     
    6164class DeclarationWithType : public Declaration {
    6265  public:
    63         DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpec fs = DeclarationNode::FuncSpec() );
     66        DeclarationWithType( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs );
    6467        DeclarationWithType( const DeclarationWithType &other );
    6568        virtual ~DeclarationWithType();
     
    7982        const std::list< Attribute * >& get_attributes() const { return attributes; }
    8083
    81         DeclarationNode::FuncSpec get_funcSpec() const { return fs; }
    82         void set_functionSpecifiers( DeclarationNode::FuncSpec newValue ) { fs = newValue; }
     84        DeclarationNode::FuncSpecifiers get_funcSpec() const { return fs; }
     85        //void set_functionSpecifiers( DeclarationNode::FuncSpecifiers newValue ) { fs = newValue; }
    8386
    8487        virtual DeclarationWithType *clone() const = 0;
     
    9598        ConstantExpr *asmName;
    9699        std::list< Attribute * > attributes;
    97         DeclarationNode::FuncSpec fs;
     100        DeclarationNode::FuncSpecifiers fs;
    98101};
    99102
     
    101104        typedef DeclarationWithType Parent;
    102105  public:
    103         ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init,
    104                                 const std::list< Attribute * > attributes = std::list< Attribute * >(), DeclarationNode::FuncSpec fs = DeclarationNode::FuncSpec() );
     106        ObjectDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init,
     107                                const std::list< Attribute * > attributes = std::list< Attribute * >(), DeclarationNode::FuncSpecifiers fs = DeclarationNode::FuncSpecifiers() );
    105108        ObjectDecl( const ObjectDecl &other );
    106109        virtual ~ObjectDecl();
     
    129132        typedef DeclarationWithType Parent;
    130133  public:
    131         FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements,
    132                                   const std::list< Attribute * > attributes = std::list< Attribute * >(), DeclarationNode::FuncSpec fs = DeclarationNode::FuncSpec() );
     134        FunctionDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements,
     135                                  const std::list< Attribute * > attributes = std::list< Attribute * >(), DeclarationNode::FuncSpecifiers fs = DeclarationNode::FuncSpecifiers() );
    133136        FunctionDecl( const FunctionDecl &other );
    134137        virtual ~FunctionDecl();
     
    155158        typedef Declaration Parent;
    156159  public:
    157         NamedTypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type );
     160        NamedTypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type );
    158161        NamedTypeDecl( const NamedTypeDecl &other );
    159162        virtual ~NamedTypeDecl();
     
    190193        };
    191194
    192         TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind );
     195        TypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type, Kind kind );
    193196        TypeDecl( const TypeDecl &other );
    194197
     
    211214        typedef NamedTypeDecl Parent;
    212215  public:
    213         TypedefDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type ) : Parent( name, sc, type ) {}
     216        TypedefDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type ) : Parent( name, scs, type ) {}
    214217        TypedefDecl( const TypedefDecl &other ) : Parent( other ) {}
    215218
  • TabularUnified src/SynTree/DeclarationWithType.cc

    r7fe2498 ra7c90d4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar  3 20:59:28 2017
    13 // Update Count     : 19
     12// Last Modified On : Tue Mar  7 07:32:14 2017
     13// Update Count     : 23
    1414//
    1515
     
    1919#include "Common/utility.h"
    2020
    21 DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpec fs )
    22         : Declaration( name, sc, linkage ), asmName( nullptr ), attributes( attributes ), fs( fs ) {
     21DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs )
     22        : Declaration( name, scs, linkage ), asmName( nullptr ), attributes( attributes ), fs( fs ) {
    2323}
    2424
    2525DeclarationWithType::DeclarationWithType( const DeclarationWithType &other )
    26         : Declaration( other ), mangleName( other.mangleName ), scopeLevel( other.scopeLevel ), fs( other.fs ) {
     26                : Declaration( other ), mangleName( other.mangleName ), scopeLevel( other.scopeLevel ), fs( other.fs ) {
    2727        cloneAll( other.attributes, attributes );
    2828        asmName = maybeClone( other.asmName );
  • TabularUnified src/SynTree/FunctionDecl.cc

    r7fe2498 ra7c90d4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar  3 21:29:41 2017
    13 // Update Count     : 55
     12// Last Modified On : Tue Mar  7 07:54:58 2017
     13// Update Count     : 68
    1414//
    1515
     
    2626extern bool translation_unit_nomain;
    2727
    28 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, std::list< Attribute * > attributes, DeclarationNode::FuncSpec fs )
    29                 : Parent( name, sc, linkage, attributes, fs ), type( type ), statements( statements ) {
    30         set_functionSpecifiers( fs );
    31 
     28FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, std::list< Attribute * > attributes, DeclarationNode::FuncSpecifiers fs )
     29        : Parent( name, scs, linkage, attributes, fs ), type( type ), statements( statements ) {
    3230        // hack forcing the function "main" to have Cforall linkage to replace main even if it is inside an extern
    3331        if ( name == "main" ) {
     
    3735
    3836FunctionDecl::FunctionDecl( const FunctionDecl &other )
    39         : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {
     37                : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {
    4038}
    4139
     
    6765        printAll( get_attributes(), os, indent );
    6866
    69         if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    70                 os << DeclarationNode::storageClassNames[ get_storageClass() ] << ' ';
    71         } // if
     67        DeclarationNode::print_StorageClass( os, get_storageClasses() );
    7268        DeclarationNode::print_FuncSpec( os, get_funcSpec() );
    7369
     
    9591        // xxx - should printShort print attributes?
    9692
    97         if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    98                 os << DeclarationNode::storageClassNames[ get_storageClass() ] << ' ';
    99         } // if
     93        DeclarationNode::print_StorageClass( os, get_storageClasses() );
    10094        DeclarationNode::print_FuncSpec( os, get_funcSpec() );
    10195
  • TabularUnified src/SynTree/NamedTypeDecl.cc

    r7fe2498 ra7c90d4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb 28 16:13:24 2017
    13 // Update Count     : 4
     12// Last Modified On : Tue Mar  7 07:39:41 2017
     13// Update Count     : 10
    1414//
    1515
     
    1818#include "Common/utility.h"
    1919
    20 NamedTypeDecl::NamedTypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *base )
    21         : Parent( name, sc, LinkageSpec::Cforall ), base( base ) {}
     20NamedTypeDecl::NamedTypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *base )
     21        : Parent( name, scs, LinkageSpec::Cforall ), base( base ) {}
    2222
    2323NamedTypeDecl::NamedTypeDecl( const NamedTypeDecl &other )
     
    3939                os << get_name() << ": ";
    4040        } // if
    41         if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    42                 os << DeclarationNode::storageClassNames[ get_storageClass() ] << ' ';
    43         } // if
     41        DeclarationNode::print_StorageClass( os, get_storageClasses() );
    4442        os << typeString();
    4543        if ( base ) {
     
    6361                os << get_name() << ": ";
    6462        } // if
    65         if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    66                 os << DeclarationNode::storageClassNames[ get_storageClass() ] << ' ';
    67         } // if
     63        DeclarationNode::print_StorageClass( os, get_storageClasses() );
    6864        os << typeString();
    6965        if ( base ) {
  • TabularUnified src/SynTree/ObjectDecl.cc

    r7fe2498 ra7c90d4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar  3 20:59:27 2017
    13 // Update Count     : 45
     12// Last Modified On : Tue Mar  7 07:55:24 2017
     13// Update Count     : 54
    1414//
    1515
     
    2222#include "Statement.h"
    2323
    24 ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, DeclarationNode::FuncSpec fs )
    25         : Parent( name, sc, linkage, attributes, fs ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) {
    26         set_functionSpecifiers( fs );
     24ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, DeclarationNode::FuncSpecifiers fs )
     25        : Parent( name, scs, linkage, attributes, fs ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) {
    2726}
    2827
     
    4847        printAll( get_attributes(), os, indent );
    4948
    50         if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    51                 os << DeclarationNode::storageClassNames[ get_storageClass() ] << ' ';
    52         } // if
     49        DeclarationNode::print_StorageClass( os, get_storageClasses() );
    5350
    5451        if ( get_type() ) {
     
    8481        // xxx - should printShort print attributes?
    8582
    86         if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    87                 os << DeclarationNode::storageClassNames[ get_storageClass() ] << ' ';
    88         } // if
     83        DeclarationNode::print_StorageClass( os, get_storageClasses() );
    8984
    9085        if ( get_type() ) {
  • TabularUnified src/SynTree/TypeDecl.cc

    r7fe2498 ra7c90d4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun 13 08:14:35 2015
    13 // Update Count     : 2
     12// Last Modified On : Tue Mar  7 07:39:09 2017
     13// Update Count     : 4
    1414//
    1515
     
    1818#include "Common/utility.h"
    1919
    20 TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ), sized( kind == Any || kind == Ttype ) {
     20TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type, Kind kind ) : Parent( name, scs, type ), kind( kind ), sized( kind == Any || kind == Ttype ) {
    2121}
    2222
Note: See TracChangeset for help on using the changeset viewer.