Changeset 255b294 for src/Parser/TypeData.cc
- Timestamp:
- Feb 24, 2017, 1:28:00 PM (7 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, with_gc
- Children:
- 23c4aa8
- Parents:
- c00ddfe (diff), 783dfd6 (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
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/TypeData.cc
rc00ddfe r255b294 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Feb 19 09:49:33201713 // Update Count : 4 6712 // Last Modified On : Thu Feb 23 16:26:39 2017 13 // Update Count : 477 14 14 // 15 15 … … 48 48 function.oldDeclList = nullptr; 49 49 function.body = nullptr; 50 function.hasBody = false;51 50 function.newStyle = false; 52 51 break; … … 68 67 enumeration.name = nullptr; 69 68 enumeration.constants = nullptr; 69 enumeration.body = false; 70 70 break; 71 71 case Symbolic: … … 182 182 newtype->function.oldDeclList = maybeClone( function.oldDeclList ); 183 183 newtype->function.body = maybeClone( function.body ); 184 newtype->function.hasBody = function.hasBody;185 184 newtype->function.newStyle = function.newStyle; 186 185 break; … … 200 199 newtype->enumeration.name = enumeration.name ? new string( *enumeration.name ) : nullptr; 201 200 newtype->enumeration.constants = maybeClone( enumeration.constants ); 201 newtype->enumeration.body = enumeration.body; 202 202 break; 203 203 case Symbolic: … … 293 293 } // if 294 294 os << endl; 295 if ( function. hasBody ) {295 if ( function.body ) { 296 296 os << string( indent + 2, ' ' ) << "with body " << endl; 297 } // if298 if ( function.body ) {299 297 function.body->printList( os, indent + 2 ); 300 298 } // if … … 335 333 os << "with constants" << endl; 336 334 enumeration.constants->printList( os, indent + 2 ); 335 } // if 336 if ( enumeration.body ) { 337 os << string( indent + 2, ' ' ) << " with body " << endl; 337 338 } // if 338 339 break; … … 696 697 } // if 697 698 } // for 699 ret->set_body( td->enumeration.body ); 698 700 return ret; 699 701 } // buildEnum … … 724 726 Declaration * buildDecl( const TypeData * td, const string &name, DeclarationNode::StorageClass sc, Expression * bitfieldWidth, bool isInline, bool isNoreturn, LinkageSpec::Spec linkage, ConstantExpr *asmName, Initializer * init, std::list< Attribute * > attributes ) { 725 727 if ( td->kind == TypeData::Function ) { 726 if ( td->function.idList ) { 727 buildKRFunction( td->function ); 728 if ( td->function.idList ) { // KR function ? 729 buildKRFunction( td->function ); // transform into C11 function 728 730 } // if 729 731 730 732 FunctionDecl * decl; 731 if ( td->function.hasBody ) { 732 if ( td->function.body ) { 733 Statement * stmt = td->function.body->build(); 734 CompoundStmt * body = dynamic_cast< CompoundStmt* >( stmt ); 735 assert( body ); 736 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), body, isInline, isNoreturn, attributes ); 737 } else { 738 // list< Label > ls; 739 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), new CompoundStmt( list< Label >() ), isInline, isNoreturn, attributes ); 740 } // if 741 } else { 742 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), nullptr, isInline, isNoreturn, attributes ); 743 } // if 733 Statement * stmt = maybeBuild<Statement>( td->function.body ); 734 CompoundStmt * body = dynamic_cast< CompoundStmt* >( stmt ); 735 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), body, isInline, isNoreturn, attributes ); 744 736 return decl->set_asmName( asmName ); 745 737 } else if ( td->kind == TypeData::Aggregate ) { … … 816 808 817 809 for ( DeclarationNode * param = function.idList; param != nullptr; param = dynamic_cast< DeclarationNode* >( param->get_next() ) ) { 818 if ( ! param->type ) { // generate type int for empty parameter s810 if ( ! param->type ) { // generate type int for empty parameter type 819 811 param->type = new TypeData( TypeData::Basic ); 820 812 param->type->basictype = DeclarationNode::Int;
Note: See TracChangeset
for help on using the changeset viewer.