Changes in src/SynTree/FunctionDecl.cc [03e5d14:7baed7d]
- File:
-
- 1 edited
-
src/SynTree/FunctionDecl.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/FunctionDecl.cc
r03e5d14 r7baed7d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 06 15: 41:05201612 // Last Modified On : Fri May 06 15:59:48 2016 13 13 // Update Count : 19 14 14 // … … 19 19 #include "Statement.h" 20 20 #include "Type.h" 21 #include "Attribute.h" 21 22 #include "Common/utility.h" 22 23 23 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, Attribute attribute)24 : Parent( name, sc, linkage ), type( type ), statements( statements ), attribute ( attribute) {24 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, std::list< Attribute * > attributes ) 25 : Parent( name, sc, linkage ), type( type ), statements( statements ), attributes( attributes ) { 25 26 set_isInline( isInline ); 26 27 set_isNoreturn( isNoreturn ); … … 32 33 33 34 FunctionDecl::FunctionDecl( const FunctionDecl &other ) 34 : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ), attribute( other.attribute ) { 35 : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) { 36 cloneAll( other.attributes, attributes ); 35 37 } 36 38 … … 38 40 delete type; 39 41 delete statements; 42 deleteAll( attributes ); 40 43 } 41 44 … … 65 68 os << "_Noreturn "; 66 69 } // if 67 switch ( attribute.type ) { 68 case Attribute::Constructor: 69 os << "Global Constructor "; 70 break; 71 case Attribute::Destructor: 72 os << "Global Destructor "; 73 break; 74 default: 75 break; 76 } 77 if ( attribute.priority != Attribute::Default ) { 78 os << "with priority " << attribute.priority << " "; 79 } 70 71 printAll( attributes, os, indent ); 72 80 73 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 81 74 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; … … 100 93 if ( statements ) { 101 94 os << string( indent + 2, ' ' ) << "with body " << endl; 95 os << string( indent + 4, ' ' ); 102 96 statements->print( os, indent + 4 ); 103 97 } // if … … 117 111 os << "_Noreturn "; 118 112 } // if 119 switch ( attribute.type ) { 120 case Attribute::Constructor: 121 os << " Global Constructor "; 122 break; 123 case Attribute::Destructor: 124 os << " Global Destructor "; 125 break; 126 default: 127 break; 128 } 129 if ( attribute.priority != Attribute::Default ) { 130 os << "with priority " << attribute.priority << " "; 131 } 113 114 // xxx - should printShort print attributes? 115 132 116 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 133 117 os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
Note:
See TracChangeset
for help on using the changeset viewer.