Changeset b5b0907 for src/SynTree
- Timestamp:
- Jun 15, 2015, 12:45:26 PM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 94b4364
- Parents:
- ea9b9d3 (diff), a1d5d2a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/SynTree
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/SynTree/AggregateDecl.cc ¶
rea9b9d3 rb5b0907 10 10 // Created On : Sun May 17 23:56:39 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 19 16:52:08201513 // Update Count : 512 // Last Modified On : Sat Jun 13 08:12:49 2015 13 // Update Count : 6 14 14 // 15 15 … … 19 19 20 20 21 AggregateDecl::AggregateDecl( const std::string &name ) : Parent( name, Declaration ::NoStorageClass, LinkageSpec::Cforall ) {21 AggregateDecl::AggregateDecl( const std::string &name ) : Parent( name, DeclarationNode::NoStorageClass, LinkageSpec::Cforall ) { 22 22 } 23 23 -
TabularUnified src/SynTree/Declaration.cc ¶
rea9b9d3 rb5b0907 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:18:35201513 // Update Count : 212 // Last Modified On : Sat Jun 13 08:07:20 2015 13 // Update Count : 9 14 14 // 15 15 … … 22 22 #include "utility.h" 23 23 24 const char* Declaration::storageClassName[] = { "", "auto", "static", "extern", "register" };25 26 24 static UniqueId lastUniqueId = 0; 27 25 typedef std::map< UniqueId, Declaration* > IdMapType; 28 26 static IdMapType idMap; 29 27 30 Declaration::Declaration( const std::string &name, StorageClass sc, LinkageSpec::Type linkage )31 : name( name ), storageClass( sc ), linkage( linkage ), uniqueId( 0 ) {28 Declaration::Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage ) 29 : name( name ), storageClass( sc ), linkage( linkage ), uniqueId( 0 ) { 32 30 } 33 31 34 32 Declaration::Declaration( const Declaration &other ) 35 : name( other.name ), storageClass( other.storageClass ), linkage( other.linkage ), uniqueId( other.uniqueId ) {33 : name( other.name ), storageClass( other.storageClass ), linkage( other.linkage ), uniqueId( other.uniqueId ) { 36 34 } 37 35 … … 44 42 } 45 43 46 /* static class method */47 44 Declaration *Declaration::declFromId( UniqueId id ) { 48 45 IdMapType::const_iterator i = idMap.find( id ); 49 if ( i != idMap.end() ) { 50 return i->second; 51 } else { 52 return 0; 53 } // if 46 return i != idMap.end() ? i->second : 0; 54 47 } 55 48 56 /* static class method */57 49 void Declaration::dumpIds( std::ostream &os ) { 58 50 for ( IdMapType::const_iterator i = idMap.begin(); i != idMap.end(); ++i ) { -
TabularUnified src/SynTree/Declaration.h ¶
rea9b9d3 rb5b0907 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Jun 7 22:03:43201513 // Update Count : 712 // Last Modified On : Fri Jun 12 23:55:26 2015 13 // Update Count : 24 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(); … … 40 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 ); 115 104 FunctionDecl( const FunctionDecl &other ); 116 105 virtual ~FunctionDecl(); … … 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 -
TabularUnified src/SynTree/DeclarationWithType.cc ¶
rea9b9d3 rb5b0907 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:20:23201513 // Update Count : 212 // Last Modified On : Sat Jun 13 08:08:07 2015 13 // Update Count : 3 14 14 // 15 15 … … 18 18 #include "utility.h" 19 19 20 DeclarationWithType::DeclarationWithType( const std::string &name, StorageClass sc, LinkageSpec::Type linkage )20 DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage ) 21 21 : Declaration( name, sc, linkage ) { 22 22 } -
TabularUnified src/SynTree/FunctionDecl.cc ¶
rea9b9d3 rb5b0907 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Jun 7 08:36:44201513 // Update Count : 1 212 // Last Modified On : Sat Jun 13 08:12:20 2015 13 // Update Count : 14 14 14 // 15 15 … … 21 21 #include "utility.h" 22 22 23 FunctionDecl::FunctionDecl( const std::string &name, StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline )23 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline ) 24 24 : Parent( name, sc, linkage ), type( type ), statements( statements ), isInline( isInline ) { 25 25 // this is a brazen hack to force the function "main" to have C linkage … … 60 60 os << "inline "; 61 61 } // if 62 if ( get_storageClass() != NoStorageClass ) {63 os << storageClassName[ get_storageClass() ] << ' ';62 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 63 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; 64 64 } // if 65 65 if ( get_type() ) { … … 96 96 os << "inline "; 97 97 } // if 98 if ( get_storageClass() != NoStorageClass ) {99 os << storageClassName[ get_storageClass() ] << ' ';98 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 99 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; 100 100 } // if 101 101 if ( get_type() ) { -
TabularUnified src/SynTree/NamedTypeDecl.cc ¶
rea9b9d3 rb5b0907 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Jun 7 08:36:09201513 // Update Count : 212 // Last Modified On : Sat Jun 13 08:13:55 2015 13 // Update Count : 3 14 14 // 15 15 … … 18 18 #include "utility.h" 19 19 20 NamedTypeDecl::NamedTypeDecl( const std::string &name, StorageClass sc, Type *base )20 NamedTypeDecl::NamedTypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *base ) 21 21 : Parent( name, sc, LinkageSpec::Cforall ), base( base ) {} 22 22 … … 39 39 os << get_name() << ": "; 40 40 } // if 41 if ( get_storageClass() != NoStorageClass ) {42 os << storageClassName[ get_storageClass() ] << ' ';41 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 42 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; 43 43 } // if 44 44 os << typeString(); … … 63 63 os << get_name() << ": "; 64 64 } // if 65 if ( get_storageClass() != NoStorageClass ) {66 os << storageClassName[ get_storageClass() ] << ' ';65 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 66 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; 67 67 } // if 68 68 os << typeString(); -
TabularUnified src/SynTree/ObjectDecl.cc ¶
rea9b9d3 rb5b0907 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 4 21:21:12201513 // Update Count : 1 012 // Last Modified On : Sat Jun 13 08:10:16 2015 13 // Update Count : 15 14 14 // 15 15 … … 20 20 #include "utility.h" 21 21 22 ObjectDecl::ObjectDecl( const std::string &name, StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init )22 ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init ) 23 23 : Parent( name, sc, linkage ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) { 24 24 } … … 43 43 } // if 44 44 45 if ( get_storageClass() != NoStorageClass ) {46 os << storageClassName[ get_storageClass() ] << ' ';45 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 46 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; 47 47 } // if 48 48 … … 74 74 } // if 75 75 76 if ( get_storageClass() != NoStorageClass ) {77 os << storageClassName[ get_storageClass() ] << ' ';76 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 77 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; 78 78 } // if 79 79 -
TabularUnified src/SynTree/TypeDecl.cc ¶
rea9b9d3 rb5b0907 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 11:02:11201513 // Update Count : 112 // Last Modified On : Sat Jun 13 08:14:35 2015 13 // Update Count : 2 14 14 // 15 15 … … 18 18 #include "utility.h" 19 19 20 TypeDecl::TypeDecl( const std::string &name, StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ) {20 TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ) { 21 21 } 22 22
Note: See TracChangeset
for help on using the changeset viewer.