Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Declaration.h

    rde62360d r843054c2  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun 13 09:10:31 2015
    13 // Update Count     : 25
     12// Last Modified On : Mon May 18 08:46:25 2015
     13// Update Count     : 2
    1414//
    1515
     
    2121#include "Mutator.h"
    2222#include "Parser/LinkageSpec.h"
    23 #include "Parser/ParseNode.h"
    2423
    2524class Declaration {
    2625  public:
    27         Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage );
     26        enum StorageClass { 
     27                NoStorageClass,
     28                Extern,
     29                Static,
     30                Auto,
     31                Register,
     32                Inline,
     33                Fortran,
     34        };     
     35
     36        Declaration( const std::string &name, StorageClass sc, LinkageSpec::Type linkage );
    2837        Declaration( const Declaration &other );
    2938        virtual ~Declaration();
    3039
    31         const std::string &get_name() const { return name; }
     40        std::string get_name() const { return name; }
    3241        void set_name( std::string newValue ) { name = newValue; }
    33         DeclarationNode::StorageClass get_storageClass() const { return storageClass; }
    34         void set_storageClass( DeclarationNode::StorageClass newValue ) { storageClass = newValue; }
     42        StorageClass get_storageClass() const { return storageClass; }
     43        void set_storageClass( StorageClass newValue ) { storageClass = newValue; }
    3544        LinkageSpec::Type get_linkage() const { return linkage; }
    3645        void set_linkage( LinkageSpec::Type newValue ) { linkage = newValue; }
     
    4453        virtual void printShort( std::ostream &os, int indent = 0 ) const = 0;
    4554
     55        static const char* storageClassName[]; 
     56
    4657        static void dumpIds( std::ostream &os );
    4758        static Declaration *declFromId( UniqueId id );
    4859  private:
    4960        std::string name;
    50         DeclarationNode::StorageClass storageClass;
     61        StorageClass storageClass;
    5162        LinkageSpec::Type linkage;
    5263        UniqueId uniqueId;
     
    5566class DeclarationWithType : public Declaration {
    5667  public:
    57         DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage );
     68        DeclarationWithType( const std::string &name, StorageClass sc, LinkageSpec::Type linkage );
    5869        DeclarationWithType( const DeclarationWithType &other );
    5970        virtual ~DeclarationWithType();
     
    7586        typedef DeclarationWithType Parent;
    7687  public:
    77         ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init );
     88        ObjectDecl( const std::string &name, StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init );
    7889        ObjectDecl( const ObjectDecl &other );
    7990        virtual ~ObjectDecl();
     
    101112        typedef DeclarationWithType Parent;
    102113  public:
    103         FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn );
     114        FunctionDecl( const std::string &name, StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline );
    104115        FunctionDecl( const FunctionDecl &other );
    105116        virtual ~FunctionDecl();
     
    112123        CompoundStmt *get_statements() const { return statements; }
    113124        void set_statements( CompoundStmt *newValue ) { statements = newValue; }
    114         bool get_isInline() const { return isInline; }
    115         bool get_isNoreturn() const { return isNoreturn; }
     125//    bool get_isInline() const { return isInline; }
     126//    void set_isInline( bool newValue ) { isInline = newValue; }
    116127        std::list< std::string >& get_oldIdents() { return oldIdents; }
    117128        std::list< Declaration* >& get_oldDecls() { return oldDecls; }
     
    125136        FunctionType *type;
    126137        CompoundStmt *statements;
    127         bool isInline, isNoreturn;
     138        bool isInline;
    128139        std::list< std::string > oldIdents;
    129140        std::list< Declaration* > oldDecls;
     
    133144        typedef Declaration Parent;
    134145  public:
    135         NamedTypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type );
     146        NamedTypeDecl( const std::string &name, StorageClass sc, Type *type );
    136147        NamedTypeDecl( const TypeDecl &other );
    137148        virtual ~NamedTypeDecl();
     
    158169        enum Kind { Any, Dtype, Ftype };
    159170
    160         TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind );
     171        TypeDecl( const std::string &name, StorageClass sc, Type *type, Kind kind );
    161172        TypeDecl( const TypeDecl &other );
    162173
     
    174185        typedef NamedTypeDecl Parent;
    175186  public:
    176         TypedefDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type ) : Parent( name, sc, type ) {}
     187        TypedefDecl( const std::string &name, StorageClass sc, Type *type ) : Parent( name, sc, type ) {}
    177188        TypedefDecl( const TypedefDecl &other ) : Parent( other ) {}
    178189
Note: See TracChangeset for help on using the changeset viewer.