Changeset a32b204 for translator/Parser
- Timestamp:
- May 17, 2015, 1:19:35 PM (11 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:
- 0dd3a2f
- Parents:
- b87a5ed
- Location:
- translator/Parser
- Files:
-
- 8 edited
-
DeclarationNode.cc (modified) (7 diffs)
-
ExpressionNode.cc (modified) (3 diffs)
-
InitializerNode.cc (modified) (1 diff)
-
ParseNode.cc (modified) (1 diff)
-
ParseNode.h (modified) (1 diff)
-
StatementNode.cc (modified) (3 diffs)
-
TypeData.cc (modified) (9 diffs)
-
TypedefTable.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
translator/Parser/DeclarationNode.cc
rb87a5ed ra32b204 531 531 TypeData *prevBase = type; 532 532 TypeData *curBase = type->base; 533 while ( curBase != 0 ) {533 while ( curBase != 0 ) { 534 534 prevBase = curBase; 535 535 curBase = curBase->base; … … 591 591 assert( a ); 592 592 TypeData *cur = a; 593 while ( cur->base ) {593 while ( cur->base ) { 594 594 cur = cur->base; 595 595 } … … 660 660 DeclarationNode *newnode = new DeclarationNode; 661 661 TypeData *srcType = type; 662 while ( srcType->base ) {662 while ( srcType->base ) { 663 663 srcType = srcType->base; 664 664 } … … 686 686 if ( type ) { 687 687 TypeData *srcType = type; 688 while ( srcType->base ) {688 while ( srcType->base ) { 689 689 srcType = srcType->base; 690 690 } … … 763 763 std::back_insert_iterator< std::list< Declaration* > > out( outputList ); 764 764 const DeclarationNode *cur = firstNode; 765 while ( cur ) {765 while ( cur ) { 766 766 try { 767 767 if ( DeclarationNode *extr = cur->extractAggregate() ) { … … 790 790 std::back_insert_iterator< std::list< DeclarationWithType* > > out( outputList ); 791 791 const DeclarationNode *cur = firstNode; 792 while ( cur ) {792 while ( cur ) { 793 793 try { 794 794 /// if ( DeclarationNode *extr = cur->extractAggregate() ) { … … 827 827 std::back_insert_iterator< std::list< Type* > > out( outputList ); 828 828 const DeclarationNode *cur = firstNode; 829 while ( cur ) {829 while ( cur ) { 830 830 try { 831 831 *out++ = cur->buildType(); -
translator/Parser/ExpressionNode.cc
rb87a5ed ra32b204 120 120 int i = str.length() - 1; 121 121 122 while ( i >= 0 && ! isxdigit( c = str.at( i--)) )122 while ( i >= 0 && ! isxdigit( c = str.at( i--)) ) 123 123 sfx += c; 124 124 … … 371 371 case OperatorNode::OrAssn: 372 372 // the rewrite rules for these expressions specify that the first argument has its address taken 373 assert( ! args.empty() );373 assert( ! args.empty() ); 374 374 args.front() = new AddressExpr( args.front() ); 375 375 break; … … 490 490 VarRefNode *var = dynamic_cast<VarRefNode *>( get_args()); 491 491 assert( var ); 492 if ( ! get_args()->get_link() ) {492 if ( ! get_args()->get_link() ) { 493 493 return new AttrExpr( var->build(), ( Expression*)0); 494 494 } else if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>( get_args()->get_link()) ) { -
translator/Parser/InitializerNode.cc
rb87a5ed ra32b204 56 56 os << "designated by: ("; 57 57 ExpressionNode *curdes = designator; 58 while ( curdes != 0) {58 while ( curdes != 0) { 59 59 curdes->printOneLine(os); 60 60 curdes = (ExpressionNode *)(curdes->get_link()); -
translator/Parser/ParseNode.cc
rb87a5ed ra32b204 50 50 ParseNode *current = this; 51 51 52 while ( current->get_link() != 0 )52 while ( current->get_link() != 0 ) 53 53 current = current->get_link(); 54 54 -
translator/Parser/ParseNode.h
rb87a5ed ra32b204 493 493 cur = dynamic_cast< NodeType *>( cur->get_link() ); 494 494 } // while 495 if ( ! errors.isEmpty() ) {495 if ( ! errors.isEmpty() ) { 496 496 throw errors; 497 497 } // if -
translator/Parser/StatementNode.cc
rb87a5ed ra32b204 171 171 void StatementNode::print( std::ostream &os, int indent ) const { 172 172 if ( labels != 0 ) 173 if (! labels->empty()) {173 if (! labels->empty()) { 174 174 std::list<std::string>::const_iterator i; 175 175 176 176 os << '\r' << string( indent, ' '); 177 for ( i = labels->begin(); i != labels->end(); i++ )177 for ( i = labels->begin(); i != labels->end(); i++ ) 178 178 os << *i << ":"; 179 179 os << endl; 180 180 } 181 181 182 switch ( type ) {182 switch ( type ) { 183 183 case Decl: 184 184 decl->print( os, indent ); … … 232 232 buildList<Statement, StatementNode>( get_block(), branches ); 233 233 234 switch ( type ) {234 switch ( type ) { 235 235 case Decl: 236 236 return new DeclStmt( labs, maybeBuild< Declaration >( decl ) ); … … 251 251 thenb = branches.front(); 252 252 branches.pop_front(); 253 if ( ! branches.empty() ) {253 if ( ! branches.empty() ) { 254 254 elseb = branches.front(); 255 255 branches.pop_front(); -
translator/Parser/TypeData.cc
rb87a5ed ra32b204 405 405 switch ( kind ) { 406 406 case Aggregate: 407 if ( ! toplevel && aggregate->members ) {407 if ( ! toplevel && aggregate->members ) { 408 408 ret = clone(); 409 409 ret->qualifiers.clear(); … … 411 411 break; 412 412 case Enum: 413 if ( ! toplevel && enumeration->constants ) {413 if ( ! toplevel && enumeration->constants ) { 414 414 ret = clone(); 415 415 ret->qualifiers.clear(); … … 556 556 557 557 for ( std::list< DeclarationNode::BasicType >::const_iterator i = basic->typeSpec.begin(); i != basic->typeSpec.end(); ++i ) { 558 if ( ! init ) {558 if ( ! init ) { 559 559 init = true; 560 560 if ( *i == DeclarationNode::Void ) { 561 if ( basic->typeSpec.size() != 1 || ! basic->modifiers.empty() ) {561 if ( basic->typeSpec.size() != 1 || ! basic->modifiers.empty() ) { 562 562 throw SemanticError( "invalid type specifier \"void\" in type: ", this ); 563 563 } else { … … 635 635 switch ( *i ) { 636 636 case DeclarationNode::Long: 637 if ( ! init ) {637 if ( ! init ) { 638 638 init = true; 639 639 ret = BasicType::LongSignedInt; … … 667 667 break; 668 668 case DeclarationNode::Short: 669 if ( ! init ) {669 if ( ! init ) { 670 670 init = true; 671 671 ret = BasicType::ShortSignedInt; … … 684 684 break; 685 685 case DeclarationNode::Signed: 686 if ( ! init ) {686 if ( ! init ) { 687 687 init = true; 688 688 ret = BasicType::SignedInt; … … 709 709 break; 710 710 case DeclarationNode::Unsigned: 711 if ( ! init ) {711 if ( ! init ) { 712 712 init = true; 713 713 ret = BasicType::UnsignedInt; … … 744 744 745 745 BasicType *bt; 746 if ( ! init ) {746 if ( ! init ) { 747 747 bt = new BasicType( buildQualifiers(), BasicType::SignedInt ); 748 748 } else { … … 781 781 assert( kind == Function ); 782 782 bool hasEllipsis = function->params ? function->params->get_hasEllipsis() : true; 783 if ( ! function->params ) hasEllipsis = !function->newStyle;783 if ( ! function->params ) hasEllipsis = ! function->newStyle; 784 784 FunctionType *ft = new FunctionType( buildQualifiers(), hasEllipsis ); 785 785 buildList( function->params, ft->get_parameters() ); -
translator/Parser/TypedefTable.cc
rb87a5ed ra32b204 64 64 } else { 65 65 list<Entry>::iterator listPos = (*curPos ).second.begin(); 66 while ( listPos != (*curPos ).second.end() && listPos->scope > scope ) {66 while ( listPos != (*curPos ).second.end() && listPos->scope > scope ) { 67 67 listPos++; 68 68 } … … 123 123 for ( tableType::iterator i = table.begin(); i != table.end(); ) { 124 124 list<Entry> &declList = (*i ).second; 125 while (! declList.empty() && declList.front().scope == currentScope ) {125 while (! declList.empty() && declList.front().scope == currentScope ) { 126 126 declList.pop_front(); 127 127 }
Note:
See TracChangeset
for help on using the changeset viewer.