Changeset 937e51d for src/SynTree/FunctionDecl.cc
- Timestamp:
- Jun 26, 2015, 4:00: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:
- 0df292b, e0ff3e6
- Parents:
- eb50842 (diff), 1869adf (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. - File:
-
- 1 edited
-
src/SynTree/FunctionDecl.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/FunctionDecl.cc
reb50842 r937e51d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu May 21 21:31:16201513 // Update Count : 1 112 // Last Modified On : Sat Jun 13 09:10:32 2015 13 // Update Count : 16 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)24 : Parent( name, sc, linkage ), type( type ), statements( statements ), isInline( isInline ) {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 ) { 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) {32 : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ), isInline( other.isInline ), isNoreturn( other.isNoreturn ) { 33 33 } 34 34 … … 52 52 53 53 if ( get_name() != "" ) { 54 os << get_name() << ": a";54 os << get_name() << ": "; 55 55 } // if 56 56 if ( get_linkage() != LinkageSpec::Cforall ) { … … 60 60 os << "inline "; 61 61 } // if 62 if ( get_storageClass() != NoStorageClass ) { 63 os << storageClassName[ get_storageClass() ] << ' '; 62 if ( isNoreturn ) { 63 os << "_Noreturn "; 64 } // if 65 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 66 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; 64 67 } // if 65 68 if ( get_type() ) { … … 70 73 71 74 if ( ! oldIdents.empty() ) { 72 os << string( indent +2, ' ' ) << "with parameter names" << endl;75 os << string( indent + 2, ' ' ) << "with parameter names" << endl; 73 76 for ( std::list< std::string >::const_iterator i = oldIdents.begin(); i != oldIdents.end(); ++i ) { 74 os << string( indent +4, ' ' ) << *i << endl;77 os << string( indent + 4, ' ' ) << *i << endl; 75 78 } // for 76 79 } // if 77 80 78 81 if ( ! oldDecls.empty() ) { 79 os << string( indent +2, ' ' ) << "with parameter declarations" << endl;80 printAll( oldDecls, os, indent +4 );82 os << string( indent + 2, ' ' ) << "with parameter declarations" << endl; 83 printAll( oldDecls, os, indent + 4 ); 81 84 } // if 82 85 if ( statements ) { 83 os << string( indent +2, ' ' ) << "with body " << endl;84 statements->print( os, indent +4 );86 os << string( indent + 2, ' ' ) << "with body " << endl; 87 statements->print( os, indent + 4 ); 85 88 } // if 86 89 } … … 91 94 92 95 if ( get_name() != "" ) { 93 os << get_name() << ": a";96 os << get_name() << ": "; 94 97 } // if 95 98 if ( isInline ) { 96 99 os << "inline "; 97 100 } // if 98 if ( get_storageClass() != NoStorageClass ) { 99 os << storageClassName[ get_storageClass() ] << ' '; 101 if ( isNoreturn ) { 102 os << "_Noreturn "; 103 } // if 104 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 105 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; 100 106 } // if 101 107 if ( get_type() ) {
Note:
See TracChangeset
for help on using the changeset viewer.