Changeset 1db21619 for src/SynTree
- Timestamp:
- Jul 16, 2015, 5:28:24 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:
- 994ec2c
- Parents:
- 724c2b6
- Location:
- src/SynTree
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Declaration.cc
r724c2b6 r1db21619 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:07:20201513 // Update Count : 912 // Last Modified On : Mon Jul 13 17:58:38 2015 13 // Update Count : 10 14 14 // 15 15 … … 27 27 28 28 Declaration::Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage ) 29 : name( name ), storageClass( sc ), linkage( linkage ), uniqueId( 0 ) {29 : name( name ), storageClass( sc ), linkage( linkage ), isInline( false ), isNoreturn( false ), uniqueId( 0 ) { 30 30 } 31 31 32 32 Declaration::Declaration( const Declaration &other ) 33 : name( other.name ), storageClass( other.storageClass ), linkage( other.linkage), uniqueId( other.uniqueId ) {33 : name( other.name ), storageClass( other.storageClass ), linkage( other.linkage ), isInline( other.isInline ), isNoreturn( other.isNoreturn ), uniqueId( other.uniqueId ) { 34 34 } 35 35 -
src/SynTree/Declaration.h
r724c2b6 r1db21619 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 09:10:31201513 // Update Count : 2 512 // Last Modified On : Mon Jul 13 18:15:59 2015 13 // Update Count : 28 14 14 // 15 15 … … 35 35 LinkageSpec::Type get_linkage() const { return linkage; } 36 36 void set_linkage( LinkageSpec::Type newValue ) { linkage = newValue; } 37 bool get_isInline() const { return isInline; } 38 void set_isInline( bool newValue ) { isInline = newValue; } 39 bool get_isNoreturn() const { return isNoreturn; } 40 void set_isNoreturn( bool newValue ) { isNoreturn = newValue; } 37 41 UniqueId get_uniqueId() const { return uniqueId; } 38 42 … … 50 54 DeclarationNode::StorageClass storageClass; 51 55 LinkageSpec::Type linkage; 56 bool isInline, isNoreturn; 52 57 UniqueId uniqueId; 53 58 }; … … 75 80 typedef DeclarationWithType Parent; 76 81 public: 77 ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init );82 ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, bool isInline = false, bool isNoreturn = false ); 78 83 ObjectDecl( const ObjectDecl &other ); 79 84 virtual ~ObjectDecl(); … … 89 94 virtual ObjectDecl *clone() const { return new ObjectDecl( *this ); } 90 95 virtual void accept( Visitor &v ) { v.visit( this ); } 91 virtual ObjectDecl*acceptMutator( Mutator &m ) { return m.mutate( this ); }96 virtual DeclarationWithType *acceptMutator( Mutator &m ) { return m.mutate( this ); } 92 97 virtual void print( std::ostream &os, int indent = 0 ) const; 93 98 virtual void printShort( std::ostream &os, int indent = 0 ) const; … … 112 117 CompoundStmt *get_statements() const { return statements; } 113 118 void set_statements( CompoundStmt *newValue ) { statements = newValue; } 114 bool get_isInline() const { return isInline; }115 bool get_isNoreturn() const { return isNoreturn; }116 119 std::list< std::string >& get_oldIdents() { return oldIdents; } 117 120 std::list< Declaration* >& get_oldDecls() { return oldDecls; } … … 125 128 FunctionType *type; 126 129 CompoundStmt *statements; 127 bool isInline, isNoreturn;128 130 std::list< std::string > oldIdents; 129 131 std::list< Declaration* > oldDecls; -
src/SynTree/FunctionDecl.cc
r724c2b6 r1db21619 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 09:10:32201513 // Update Count : 1 612 // Last Modified On : Mon Jul 13 18:11:44 2015 13 // Update Count : 19 14 14 // 15 15 … … 22 22 23 23 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn ) 24 : Parent( name, sc, linkage ), type( type ), statements( statements ), isInline( isInline ), isNoreturn( isNoreturn ) { 24 : Parent( name, sc, linkage ), type( type ), statements( statements ) { 25 set_isInline( isInline ); 26 set_isNoreturn( isNoreturn ); 25 27 // this is a brazen hack to force the function "main" to have C linkage 26 28 if ( name == "main" ) { … … 30 32 31 33 FunctionDecl::FunctionDecl( const FunctionDecl &other ) 32 : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) , isInline( other.isInline ), isNoreturn( other.isNoreturn ){34 : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) { 33 35 } 34 36 … … 57 59 os << LinkageSpec::toString( get_linkage() ) << " "; 58 60 } // if 59 if ( isInline) {61 if ( get_isInline() ) { 60 62 os << "inline "; 61 63 } // if 62 if ( isNoreturn) {64 if ( get_isNoreturn() ) { 63 65 os << "_Noreturn "; 64 66 } // if … … 96 98 os << get_name() << ": "; 97 99 } // if 98 if ( isInline) {100 if ( get_isInline() ) { 99 101 os << "inline "; 100 102 } // if 101 if ( isNoreturn) {103 if ( get_isNoreturn() ) { 102 104 os << "_Noreturn "; 103 105 } // if -
src/SynTree/Mutator.cc
r724c2b6 r1db21619 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : T ue Jul 14 12:31:39201513 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 16 16:10:54 2015 13 // Update Count : 3 14 14 // 15 15 … … 28 28 Mutator::~Mutator() {} 29 29 30 ObjectDecl*Mutator::mutate( ObjectDecl *objectDecl ) {30 DeclarationWithType *Mutator::mutate( ObjectDecl *objectDecl ) { 31 31 objectDecl->set_type( maybeMutate( objectDecl->get_type(), *this ) ); 32 32 objectDecl->set_init( maybeMutate( objectDecl->get_init(), *this ) ); -
src/SynTree/Mutator.h
r724c2b6 r1db21619 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri May 29 16:34:08201513 // Update Count : 411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jul 13 18:14:47 2015 13 // Update Count : 5 14 14 // 15 15 #include <cassert> … … 26 26 virtual ~Mutator(); 27 27 public: 28 virtual ObjectDecl* mutate( ObjectDecl *objectDecl );28 virtual DeclarationWithType* mutate( ObjectDecl *objectDecl ); 29 29 virtual DeclarationWithType* mutate( FunctionDecl *functionDecl ); 30 30 virtual Declaration* mutate( StructDecl *aggregateDecl ); -
src/SynTree/ObjectDecl.cc
r724c2b6 r1db21619 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:10:16201513 // Update Count : 1 512 // Last Modified On : Mon Jul 13 18:08:27 2015 13 // Update Count : 16 14 14 // 15 15 … … 20 20 #include "utility.h" 21 21 22 ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::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, bool isInline, bool isNoreturn ) 23 23 : Parent( name, sc, linkage ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) { 24 set_isInline( isInline ); 25 set_isNoreturn( isNoreturn ); 24 26 } 25 27 -
src/SynTree/Type.cc
r724c2b6 r1db21619 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 May 19 16:52:27201513 // Update Count : 212 // Last Modified On : Thu Jul 9 16:45:13 2015 13 // Update Count : 3 14 14 // 15 15 … … 75 75 os << "_Atomic "; 76 76 } // if 77 if ( tq.isAttribute ) { 78 os << "__attribute(( )) "; 79 } // if 77 80 } 78 81 -
src/SynTree/Type.h
r724c2b6 r1db21619 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jun 26 16:47:54201513 // Update Count : 1 312 // Last Modified On : Thu Jul 9 16:46:15 2015 13 // Update Count : 14 14 14 // 15 15 … … 25 25 struct Qualifiers { 26 26 Qualifiers(): isConst( false ), isVolatile( false ), isRestrict( false ), isLvalue( false ), isAtomic( false ), isAttribute( false ) {} 27 Qualifiers( bool isConst, bool isVolatile, bool isRestrict, bool isLvalue, bool isAtomic, bool isAttribute ): isConst( isConst ), isVolatile( isVolatile ), isRestrict( isRestrict ), isLvalue( isLvalue ), isAtomic( isAtomic ), isAttribute( isAttribute ) {}27 Qualifiers( bool isConst, bool isVolatile, bool isRestrict, bool isLvalue, bool isAtomic, bool isAttribute ): isConst( isConst ), isVolatile( isVolatile ), isRestrict( isRestrict ), isLvalue( isLvalue ), isAtomic( isAtomic ), isAttribute( isAttribute ) {} 28 28 29 29 Qualifiers &operator+=( const Qualifiers &other );
Note:
See TracChangeset
for help on using the changeset viewer.