Changeset 68fe077a for src/SynTree
- Timestamp:
- Mar 16, 2017, 8:23:42 AM (8 years ago)
- 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:
- 26ba208
- Parents:
- 6e8bd43
- git-author:
- Peter A. Buhr <pabuhr@…> (03/16/17 08:19:39)
- git-committer:
- Peter A. Buhr <pabuhr@…> (03/16/17 08:23:42)
- Location:
- src/SynTree
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/AggregateDecl.cc
r6e8bd43 r68fe077a 10 10 // Created On : Sun May 17 23:56:39 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Mar 7 07:31:47 201713 // Update Count : 1912 // Last Modified On : Thu Mar 16 07:49:07 2017 13 // Update Count : 20 14 14 // 15 15 … … 20 20 21 21 22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, DeclarationNode::StorageClasses(), LinkageSpec::Cforall ), body( false ), attributes( attributes ) {22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, Type::StorageClasses(), LinkageSpec::Cforall ), body( false ), attributes( attributes ) { 23 23 } 24 24 -
src/SynTree/Declaration.cc
r6e8bd43 r68fe077a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Mar 7 07:31:11201713 // Update Count : 2 312 // Last Modified On : Thu Mar 16 07:49:18 2017 13 // Update Count : 24 14 14 // 15 15 … … 27 27 static IdMapType idMap; 28 28 29 Declaration::Declaration( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage )29 Declaration::Declaration( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage ) 30 30 : name( name ), storageClasses( scs ), linkage( linkage ), uniqueId( 0 ) { 31 31 } … … 66 66 67 67 68 AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", DeclarationNode::StorageClasses(), LinkageSpec::C ), stmt( stmt ) {68 AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", Type::StorageClasses(), LinkageSpec::C ), stmt( stmt ) { 69 69 } 70 70 -
src/SynTree/Declaration.h
r6e8bd43 r68fe077a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Mar 7 07:40:42201713 // Update Count : 11 312 // Last Modified On : Thu Mar 16 07:48:23 2017 13 // Update Count : 117 14 14 // 15 15 … … 28 28 class Declaration : public BaseSyntaxNode { 29 29 public: 30 Declaration( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage );30 Declaration( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage ); 31 31 Declaration( const Declaration &other ); 32 32 virtual ~Declaration(); … … 35 35 void set_name( std::string newValue ) { name = newValue; } 36 36 37 DeclarationNode::StorageClasses get_storageClasses() const { return storageClasses; }37 Type::StorageClasses get_storageClasses() const { return storageClasses; } 38 38 39 39 LinkageSpec::Spec get_linkage() const { return linkage; } … … 56 56 private: 57 57 std::string name; 58 DeclarationNode::StorageClasses storageClasses;58 Type::StorageClasses storageClasses; 59 59 LinkageSpec::Spec linkage; 60 60 UniqueId uniqueId; … … 64 64 class DeclarationWithType : public Declaration { 65 65 public: 66 DeclarationWithType( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs );66 DeclarationWithType( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs ); 67 67 DeclarationWithType( const DeclarationWithType &other ); 68 68 virtual ~DeclarationWithType(); … … 104 104 typedef DeclarationWithType Parent; 105 105 public: 106 ObjectDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init,106 ObjectDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, 107 107 const std::list< Attribute * > attributes = std::list< Attribute * >(), DeclarationNode::FuncSpecifiers fs = DeclarationNode::FuncSpecifiers() ); 108 108 ObjectDecl( const ObjectDecl &other ); … … 132 132 typedef DeclarationWithType Parent; 133 133 public: 134 FunctionDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements,134 FunctionDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, 135 135 const std::list< Attribute * > attributes = std::list< Attribute * >(), DeclarationNode::FuncSpecifiers fs = DeclarationNode::FuncSpecifiers() ); 136 136 FunctionDecl( const FunctionDecl &other ); … … 158 158 typedef Declaration Parent; 159 159 public: 160 NamedTypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type );160 NamedTypeDecl( const std::string &name, Type::StorageClasses scs, Type *type ); 161 161 NamedTypeDecl( const NamedTypeDecl &other ); 162 162 virtual ~NamedTypeDecl(); … … 193 193 }; 194 194 195 TypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type, Kind kind );195 TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind ); 196 196 TypeDecl( const TypeDecl &other ); 197 197 … … 214 214 typedef NamedTypeDecl Parent; 215 215 public: 216 TypedefDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type ) : Parent( name, scs, type ) {}216 TypedefDecl( const std::string &name, Type::StorageClasses scs, Type *type ) : Parent( name, scs, type ) {} 217 217 TypedefDecl( const TypedefDecl &other ) : Parent( other ) {} 218 218 -
src/SynTree/DeclarationWithType.cc
r6e8bd43 r68fe077a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Mar 7 07:32:14201713 // Update Count : 2 312 // Last Modified On : Thu Mar 16 07:49:27 2017 13 // Update Count : 24 14 14 // 15 15 … … 19 19 #include "Common/utility.h" 20 20 21 DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs )21 DeclarationWithType::DeclarationWithType( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs ) 22 22 : Declaration( name, scs, linkage ), asmName( nullptr ), attributes( attributes ), fs( fs ) { 23 23 } -
src/SynTree/FunctionDecl.cc
r6e8bd43 r68fe077a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 15 23:33:43201713 // Update Count : 7 212 // Last Modified On : Thu Mar 16 07:49:35 2017 13 // Update Count : 73 14 14 // 15 15 … … 26 26 extern bool translation_unit_nomain; 27 27 28 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, std::list< Attribute * > attributes, DeclarationNode::FuncSpecifiers fs )28 FunctionDecl::FunctionDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, std::list< Attribute * > attributes, DeclarationNode::FuncSpecifiers fs ) 29 29 : Parent( name, scs, linkage, attributes, fs ), type( type ), statements( statements ) { 30 30 // hack forcing the function "main" to have Cforall linkage to replace main even if it is inside an extern -
src/SynTree/NamedTypeDecl.cc
r6e8bd43 r68fe077a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 15 23:25:41201713 // Update Count : 1 212 // Last Modified On : Thu Mar 16 07:49:44 2017 13 // Update Count : 13 14 14 // 15 15 … … 18 18 #include "Common/utility.h" 19 19 20 NamedTypeDecl::NamedTypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *base )20 NamedTypeDecl::NamedTypeDecl( const std::string &name, Type::StorageClasses scs, Type *base ) 21 21 : Parent( name, scs, LinkageSpec::Cforall ), base( base ) {} 22 22 -
src/SynTree/ObjectDecl.cc
r6e8bd43 r68fe077a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 15 23:26:22201713 // Update Count : 5 712 // Last Modified On : Thu Mar 16 07:49:51 2017 13 // Update Count : 58 14 14 // 15 15 … … 22 22 #include "Statement.h" 23 23 24 ObjectDecl::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 )24 ObjectDecl::ObjectDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, DeclarationNode::FuncSpecifiers fs ) 25 25 : Parent( name, scs, linkage, attributes, fs ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) { 26 26 } -
src/SynTree/Type.cc
r6e8bd43 r68fe077a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 15 23:14:35 201713 // Update Count : 1912 // Last Modified On : Thu Mar 16 07:57:45 2017 13 // Update Count : 20 14 14 // 15 15 … … 59 59 } 60 60 61 // These must remain in the same order as the corresponding bit fields. 62 const char * Type::StorageClasses::Names[] = { "extern", "static", "auto", "register", "_Thread_local" }; 61 63 const char * Type::Qualifiers::Names[] = { "const", "restrict", "volatile", "lvalue", "mutex", "_Atomic" }; 62 64 -
src/SynTree/Type.h
r6e8bd43 r68fe077a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 15 23:28:33201713 // Update Count : 8912 // Last Modified On : Thu Mar 16 07:45:29 2017 13 // Update Count : 90 14 14 // 15 15 … … 24 24 class Type : public BaseSyntaxNode { 25 25 public: 26 // enum must remain in the same order as the corresponding bit fields. 27 28 enum { Extern = 1 << 0, Static = 1 << 1, Auto = 1 << 2, Register = 1 << 3, Threadlocal = 1 << 4, NumStorageClass = 5 }; 29 union StorageClasses { 30 static const char * Names[]; 31 unsigned int val; 32 struct { 33 bool is_extern : 1; 34 bool is_static : 1; 35 bool is_auto : 1; 36 bool is_register : 1; 37 bool is_threadlocal : 1; 38 }; 39 40 StorageClasses() : val( 0 ) {} 41 StorageClasses( unsigned int val ) : val( val ) {} 42 bool operator[]( unsigned int i ) const { return val & (1 << i); } 43 bool any() const { return val != 0; } 44 void print( std::ostream & os ) const { 45 if ( (*this).any() ) { // any storage classes ? 46 for ( unsigned int i = 0; i < NumStorageClass; i += 1 ) { 47 if ( (*this)[i] ) { 48 os << StorageClasses::Names[i] << ' '; 49 } // if 50 } // for 51 } // if 52 } 53 }; // StorageClasses 54 26 55 enum { Const = 1 << 0, Restrict = 1 << 1, Volatile = 1 << 2, Lvalue = 1 << 3, Mutex = 1 << 4, Atomic = 1 << 5, NumTypeQualifier = 6 }; 27 56 union Qualifiers { -
src/SynTree/TypeDecl.cc
r6e8bd43 r68fe077a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Mar 7 07:39:09201713 // Update Count : 412 // Last Modified On : Thu Mar 16 07:49:58 2017 13 // Update Count : 5 14 14 // 15 15 … … 18 18 #include "Common/utility.h" 19 19 20 TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type, Kind kind ) : Parent( name, scs, type ), kind( kind ), sized( kind == Any || kind == Ttype ) {20 TypeDecl::TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind ) : Parent( name, scs, type ), kind( kind ), sized( kind == Any || kind == Ttype ) { 21 21 } 22 22
Note: See TracChangeset
for help on using the changeset viewer.