Changes in src/SynTree/Declaration.h [843054c2:de62360d]
- File:
-
- 1 edited
-
src/SynTree/Declaration.h (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Declaration.h
r843054c2 rde62360d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 18 08:46:25201513 // Update Count : 2 12 // Last Modified On : Sat Jun 13 09:10:31 2015 13 // Update Count : 25 14 14 // 15 15 … … 21 21 #include "Mutator.h" 22 22 #include "Parser/LinkageSpec.h" 23 #include "Parser/ParseNode.h" 23 24 24 25 class Declaration { 25 26 public: 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 ); 27 Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage ); 37 28 Declaration( const Declaration &other ); 38 29 virtual ~Declaration(); 39 30 40 std::stringget_name() const { return name; }31 const std::string &get_name() const { return name; } 41 32 void set_name( std::string newValue ) { name = newValue; } 42 StorageClass get_storageClass() const { return storageClass; }43 void set_storageClass( StorageClass newValue ) { storageClass = newValue; }33 DeclarationNode::StorageClass get_storageClass() const { return storageClass; } 34 void set_storageClass( DeclarationNode::StorageClass newValue ) { storageClass = newValue; } 44 35 LinkageSpec::Type get_linkage() const { return linkage; } 45 36 void set_linkage( LinkageSpec::Type newValue ) { linkage = newValue; } … … 53 44 virtual void printShort( std::ostream &os, int indent = 0 ) const = 0; 54 45 55 static const char* storageClassName[];56 57 46 static void dumpIds( std::ostream &os ); 58 47 static Declaration *declFromId( UniqueId id ); 59 48 private: 60 49 std::string name; 61 StorageClass storageClass;50 DeclarationNode::StorageClass storageClass; 62 51 LinkageSpec::Type linkage; 63 52 UniqueId uniqueId; … … 66 55 class DeclarationWithType : public Declaration { 67 56 public: 68 DeclarationWithType( const std::string &name, StorageClass sc, LinkageSpec::Type linkage );57 DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage ); 69 58 DeclarationWithType( const DeclarationWithType &other ); 70 59 virtual ~DeclarationWithType(); … … 86 75 typedef DeclarationWithType Parent; 87 76 public: 88 ObjectDecl( const std::string &name, StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init );77 ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init ); 89 78 ObjectDecl( const ObjectDecl &other ); 90 79 virtual ~ObjectDecl(); … … 112 101 typedef DeclarationWithType Parent; 113 102 public: 114 FunctionDecl( const std::string &name, StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline);103 FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn ); 115 104 FunctionDecl( const FunctionDecl &other ); 116 105 virtual ~FunctionDecl(); … … 123 112 CompoundStmt *get_statements() const { return statements; } 124 113 void set_statements( CompoundStmt *newValue ) { statements = newValue; } 125 //bool get_isInline() const { return isInline; }126 // void set_isInline( bool newValue ) { isInline = newValue; }114 bool get_isInline() const { return isInline; } 115 bool get_isNoreturn() const { return isNoreturn; } 127 116 std::list< std::string >& get_oldIdents() { return oldIdents; } 128 117 std::list< Declaration* >& get_oldDecls() { return oldDecls; } … … 136 125 FunctionType *type; 137 126 CompoundStmt *statements; 138 bool isInline ;127 bool isInline, isNoreturn; 139 128 std::list< std::string > oldIdents; 140 129 std::list< Declaration* > oldDecls; … … 144 133 typedef Declaration Parent; 145 134 public: 146 NamedTypeDecl( const std::string &name, StorageClass sc, Type *type );135 NamedTypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type ); 147 136 NamedTypeDecl( const TypeDecl &other ); 148 137 virtual ~NamedTypeDecl(); … … 169 158 enum Kind { Any, Dtype, Ftype }; 170 159 171 TypeDecl( const std::string &name, StorageClass sc, Type *type, Kind kind );160 TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ); 172 161 TypeDecl( const TypeDecl &other ); 173 162 … … 185 174 typedef NamedTypeDecl Parent; 186 175 public: 187 TypedefDecl( const std::string &name, StorageClass sc, Type *type ) : Parent( name, sc, type ) {}176 TypedefDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type ) : Parent( name, sc, type ) {} 188 177 TypedefDecl( const TypedefDecl &other ) : Parent( other ) {} 189 178
Note:
See TracChangeset
for help on using the changeset viewer.