Changes in src/SynTree/FunctionDecl.cc [de62360d:68cd1ce]
- File:
-
- 1 edited
-
src/SynTree/FunctionDecl.cc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/FunctionDecl.cc
rde62360d r68cd1ce 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 0 9:10:32201513 // Update Count : 1 612 // 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, 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 ){23 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline ) 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 26 26 if ( name == "main" ) { … … 30 30 31 31 FunctionDecl::FunctionDecl( const FunctionDecl &other ) 32 : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ), isInline( other.isInline ), isNoreturn( other.isNoreturn) {32 : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ), isInline( other.isInline ) { 33 33 } 34 34 … … 60 60 os << "inline "; 61 61 } // if 62 if ( isNoreturn ) {63 os << "_Noreturn ";64 } // if65 62 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 66 63 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; … … 73 70 74 71 if ( ! oldIdents.empty() ) { 75 os << string( indent +2, ' ' ) << "with parameter names" << endl;72 os << string( indent+2, ' ' ) << "with parameter names" << endl; 76 73 for ( std::list< std::string >::const_iterator i = oldIdents.begin(); i != oldIdents.end(); ++i ) { 77 os << string( indent +4, ' ' ) << *i << endl;74 os << string( indent+4, ' ' ) << *i << endl; 78 75 } // for 79 76 } // if 80 77 81 78 if ( ! oldDecls.empty() ) { 82 os << string( indent +2, ' ' ) << "with parameter declarations" << endl;83 printAll( oldDecls, os, indent +4 );79 os << string( indent+2, ' ' ) << "with parameter declarations" << endl; 80 printAll( oldDecls, os, indent+4 ); 84 81 } // if 85 82 if ( statements ) { 86 os << string( indent +2, ' ' ) << "with body " << endl;87 statements->print( os, indent +4 );83 os << string( indent+2, ' ' ) << "with body " << endl; 84 statements->print( os, indent+4 ); 88 85 } // if 89 86 } … … 98 95 if ( isInline ) { 99 96 os << "inline "; 100 } // if101 if ( isNoreturn ) {102 os << "_Noreturn ";103 97 } // if 104 98 if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
Note:
See TracChangeset
for help on using the changeset viewer.