Changeset be8bd88 for src/SynTree
- Timestamp:
- Mar 8, 2017, 3:22:50 PM (9 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, stuck-waitfor-destruct, with_gc
- Children:
- 031a2c95, 0e7ea335
- Parents:
- 87c3bef (diff), 6363ad1 (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:
-
- 9 edited
-
AggregateDecl.cc (modified) (2 diffs)
-
Declaration.cc (modified) (3 diffs)
-
Declaration.h (modified) (12 diffs)
-
DeclarationWithType.cc (modified) (2 diffs)
-
FunctionDecl.cc (modified) (5 diffs)
-
NamedTypeDecl.cc (modified) (4 diffs)
-
ObjectDecl.cc (modified) (4 diffs)
-
Type.h (modified) (3 diffs)
-
TypeDecl.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/AggregateDecl.cc
r87c3bef rbe8bd88 10 10 // Created On : Sun May 17 23:56:39 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Feb 6 15:31:23201713 // Update Count : 1 712 // Last Modified On : Tue Mar 7 07:31:47 2017 13 // Update Count : 19 14 14 // 15 15 … … 20 20 21 21 22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, DeclarationNode:: NoStorageClass, LinkageSpec::Cforall ), body( false ), attributes( attributes ) {22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, DeclarationNode::StorageClasses(), LinkageSpec::Cforall ), body( false ), attributes( attributes ) { 23 23 } 24 24 -
src/SynTree/Declaration.cc
r87c3bef rbe8bd88 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Feb 9 14:28:05201713 // Update Count : 1612 // Last Modified On : Tue Mar 7 07:31:11 2017 13 // Update Count : 23 14 14 // 15 15 … … 27 27 static IdMapType idMap; 28 28 29 Declaration::Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage )30 : name( name ), storageClass ( sc ), linkage( linkage ), isInline( false ), isNoreturn( false ), uniqueId( 0 ) {29 Declaration::Declaration( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage ) 30 : name( name ), storageClasses( scs ), linkage( linkage ), uniqueId( 0 ) { 31 31 } 32 32 33 33 Declaration::Declaration( const Declaration &other ) 34 : name( other.name ), storageClass ( other.storageClass ), linkage( other.linkage ), isInline( other.isInline ), isNoreturn( other.isNoreturn), uniqueId( other.uniqueId ) {34 : name( other.name ), storageClasses( other.storageClasses ), linkage( other.linkage ), uniqueId( other.uniqueId ) { 35 35 } 36 36 … … 66 66 67 67 68 AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", DeclarationNode:: NoStorageClass, LinkageSpec::C ), stmt( stmt ) {68 AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", DeclarationNode::StorageClasses(), LinkageSpec::C ), stmt( stmt ) { 69 69 } 70 70 -
src/SynTree/Declaration.h
r87c3bef rbe8bd88 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Feb 16 14:53:35201713 // Update Count : 5712 // Last Modified On : Tue Mar 7 07:40:42 2017 13 // Update Count : 113 14 14 // 15 15 … … 28 28 class Declaration : public BaseSyntaxNode { 29 29 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 ); 31 31 Declaration( const Declaration &other ); 32 32 virtual ~Declaration(); … … 34 34 const std::string &get_name() const { return name; } 35 35 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 38 39 LinkageSpec::Spec get_linkage() const { return linkage; } 39 40 void set_linkage( LinkageSpec::Spec newValue ) { linkage = newValue; } 40 bool get_isInline() const { return isInline; } 41 void set_isInline( bool newValue ) { isInline = newValue; } 42 bool get_isNoreturn() const { return isNoreturn; } 43 void set_isNoreturn( bool newValue ) { isNoreturn = newValue; } 41 44 42 UniqueId get_uniqueId() const { return uniqueId; } 43 45 44 bool get_extension() const { return extension; } 46 45 Declaration *set_extension( bool exten ) { extension = exten; return this; } … … 57 56 private: 58 57 std::string name; 59 DeclarationNode::StorageClass storageClass;58 DeclarationNode::StorageClasses storageClasses; 60 59 LinkageSpec::Spec linkage; 61 bool isInline, isNoreturn;62 60 UniqueId uniqueId; 63 61 bool extension = false; … … 66 64 class DeclarationWithType : public Declaration { 67 65 public: 68 DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes );66 DeclarationWithType( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs ); 69 67 DeclarationWithType( const DeclarationWithType &other ); 70 68 virtual ~DeclarationWithType(); … … 83 81 std::list< Attribute * >& get_attributes() { return attributes; } 84 82 const std::list< Attribute * >& get_attributes() const { return attributes; } 83 84 DeclarationNode::FuncSpecifiers get_funcSpec() const { return fs; } 85 //void set_functionSpecifiers( DeclarationNode::FuncSpecifiers newValue ) { fs = newValue; } 85 86 86 87 virtual DeclarationWithType *clone() const = 0; … … 97 98 ConstantExpr *asmName; 98 99 std::list< Attribute * > attributes; 100 DeclarationNode::FuncSpecifiers fs; 99 101 }; 100 102 … … 102 104 typedef DeclarationWithType Parent; 103 105 public: 104 ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes = std::list< Attribute * >(), bool isInline = false, bool isNoreturn = false ); 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() ); 105 108 ObjectDecl( const ObjectDecl &other ); 106 109 virtual ~ObjectDecl(); … … 129 132 typedef DeclarationWithType Parent; 130 133 public: 131 FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, const std::list< Attribute * > attributes = std::list< Attribute * >() ); 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() ); 132 136 FunctionDecl( const FunctionDecl &other ); 133 137 virtual ~FunctionDecl(); … … 154 158 typedef Declaration Parent; 155 159 public: 156 NamedTypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type );160 NamedTypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type ); 157 161 NamedTypeDecl( const NamedTypeDecl &other ); 158 162 virtual ~NamedTypeDecl(); … … 189 193 }; 190 194 191 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 ); 192 196 TypeDecl( const TypeDecl &other ); 193 197 … … 210 214 typedef NamedTypeDecl Parent; 211 215 public: 212 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 ) {} 213 217 TypedefDecl( const TypedefDecl &other ) : Parent( other ) {} 214 218 -
src/SynTree/DeclarationWithType.cc
r87c3bef rbe8bd88 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 13 14:49:43 201613 // Update Count : 712 // Last Modified On : Tue Mar 7 07:32:14 2017 13 // Update Count : 23 14 14 // 15 15 … … 19 19 #include "Common/utility.h" 20 20 21 DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes )22 : Declaration( name, sc , linkage ), asmName( nullptr ), attributes( attributes ) {21 DeclarationWithType::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 ) { 23 23 } 24 24 25 25 DeclarationWithType::DeclarationWithType( const DeclarationWithType &other ) 26 : Declaration( other ), mangleName( other.mangleName ), scopeLevel( other.scopeLevel ) {26 : Declaration( other ), mangleName( other.mangleName ), scopeLevel( other.scopeLevel ), fs( other.fs ) { 27 27 cloneAll( other.attributes, attributes ); 28 28 asmName = maybeClone( other.asmName ); -
src/SynTree/FunctionDecl.cc
r87c3bef rbe8bd88 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Feb 16 15:01:52201713 // Update Count : 2312 // Last Modified On : Tue Mar 7 07:54:58 2017 13 // Update Count : 68 14 14 // 15 15 … … 26 26 extern bool translation_unit_nomain; 27 27 28 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, std::list< Attribute * > attributes ) 29 : Parent( name, sc, linkage, attributes ), type( type ), statements( statements ) { 30 set_isInline( isInline ); 31 set_isNoreturn( isNoreturn ); 32 // this is a brazen hack to force the function "main" to have Cforall linkage 33 // because we want to replace the main even if it is inside an extern 28 FunctionDecl::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 ) { 30 // hack forcing the function "main" to have Cforall linkage to replace main even if it is inside an extern 34 31 if ( name == "main" ) { 35 32 set_linkage( CodeGen::FixMain::mainLinkage() ); … … 38 35 39 36 FunctionDecl::FunctionDecl( const FunctionDecl &other ) 40 : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {37 : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) { 41 38 } 42 39 … … 65 62 os << LinkageSpec::linkageName( get_linkage() ) << " "; 66 63 } // if 67 if ( get_isInline() ) {68 os << "inline ";69 } // if70 if ( get_isNoreturn() ) {71 os << "_Noreturn ";72 } // if73 64 74 65 printAll( get_attributes(), os, indent ); 75 66 76 if ( get_storageClass() != DeclarationNode::NoStorageClass ) {77 os << DeclarationNode::storageName[ get_storageClass() ] << ' ';78 } // if 67 DeclarationNode::print_StorageClass( os, get_storageClasses() ); 68 DeclarationNode::print_FuncSpec( os, get_funcSpec() ); 69 79 70 if ( get_type() ) { 80 71 get_type()->print( os, indent ); … … 97 88 os << get_name() << ": "; 98 89 } // if 99 if ( get_isInline() ) {100 os << "inline ";101 } // if102 if ( get_isNoreturn() ) {103 os << "_Noreturn ";104 } // if105 90 106 91 // xxx - should printShort print attributes? 107 92 108 if ( get_storageClass() != DeclarationNode::NoStorageClass ) {109 os << DeclarationNode::storageName[ get_storageClass() ] << ' ';110 } // if 93 DeclarationNode::print_StorageClass( os, get_storageClasses() ); 94 DeclarationNode::print_FuncSpec( os, get_funcSpec() ); 95 111 96 if ( get_type() ) { 112 97 get_type()->print( os, indent ); -
src/SynTree/NamedTypeDecl.cc
r87c3bef rbe8bd88 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jun 13 08:13:55 201513 // Update Count : 312 // Last Modified On : Tue Mar 7 07:39:41 2017 13 // Update Count : 10 14 14 // 15 15 … … 18 18 #include "Common/utility.h" 19 19 20 NamedTypeDecl::NamedTypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *base )21 : Parent( name, sc , LinkageSpec::Cforall ), base( base ) {}20 NamedTypeDecl::NamedTypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *base ) 21 : Parent( name, scs, LinkageSpec::Cforall ), base( base ) {} 22 22 23 23 NamedTypeDecl::NamedTypeDecl( const NamedTypeDecl &other ) … … 39 39 os << get_name() << ": "; 40 40 } // if 41 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 42 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; 43 } // if 41 DeclarationNode::print_StorageClass( os, get_storageClasses() ); 44 42 os << typeString(); 45 43 if ( base ) { … … 63 61 os << get_name() << ": "; 64 62 } // if 65 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 66 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; 67 } // if 63 DeclarationNode::print_StorageClass( os, get_storageClasses() ); 68 64 os << typeString(); 69 65 if ( base ) { -
src/SynTree/ObjectDecl.cc
r87c3bef rbe8bd88 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Oct 1 23:05:56 201613 // Update Count : 3212 // Last Modified On : Tue Mar 7 07:55:24 2017 13 // Update Count : 54 14 14 // 15 15 … … 22 22 #include "Statement.h" 23 23 24 ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, bool isInline, bool isNoreturn ) 25 : Parent( name, sc, linkage, attributes ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) { 26 set_isInline( isInline ); 27 set_isNoreturn( isNoreturn ); 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 ) 25 : Parent( name, scs, linkage, attributes, fs ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) { 28 26 } 29 27 … … 49 47 printAll( get_attributes(), os, indent ); 50 48 51 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 52 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; 53 } // if 49 DeclarationNode::print_StorageClass( os, get_storageClasses() ); 54 50 55 51 if ( get_type() ) { … … 85 81 // xxx - should printShort print attributes? 86 82 87 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 88 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; 89 } // if 83 DeclarationNode::print_StorageClass( os, get_storageClasses() ); 90 84 91 85 if ( get_type() ) { -
src/SynTree/Type.h
r87c3bef rbe8bd88 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 23 16:38:53201713 // Update Count : 3412 // Last Modified On : Wed Mar 1 09:11:45 2017 13 // Update Count : 41 14 14 // 15 15 … … 21 21 #include "SynTree.h" 22 22 #include "Visitor.h" 23 #include "Common/utility.h"24 23 25 24 class Type : public BaseSyntaxNode { … … 213 212 bool get_isVarArgs() const { return isVarArgs; } 214 213 void set_isVarArgs( bool newValue ) { isVarArgs = newValue; } 215 216 214 bool isTtype() const; 217 215 -
src/SynTree/TypeDecl.cc
r87c3bef rbe8bd88 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jun 13 08:14:35 201513 // Update Count : 212 // Last Modified On : Tue Mar 7 07:39:09 2017 13 // Update Count : 4 14 14 // 15 15 … … 18 18 #include "Common/utility.h" 19 19 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 ) {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 ) { 21 21 } 22 22
Note:
See TracChangeset
for help on using the changeset viewer.