Changes in / [f51ef6f:317450e]
- Location:
- src
- Files:
-
- 3 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
rf51ef6f r317450e 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 9 15:05:18201713 // Update Count : 41 712 // Last Modified On : Thu Feb 16 14:56:29 2017 13 // Update Count : 418 14 14 // 15 15 … … 141 141 } // if 142 142 output << genType( functionDecl->get_functionType(), mangleName( functionDecl ), pretty ); 143 144 // how to get this to the Functype?145 std::list< Declaration * > olds = functionDecl->get_oldDecls();146 if ( ! olds.empty() ) {147 output << " /* function has old declaration */";148 } // if149 143 150 144 asmName( functionDecl ); -
src/GenPoly/Box.cc
rf51ef6f r317450e 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 29 21:43:03 201613 // Update Count : 29 612 // Last Modified On : Thu Feb 16 14:57:16 2017 13 // Update Count : 297 14 14 // 15 15 … … 263 263 DeclarationWithType *LayoutFunctionBuilder::mutate( FunctionDecl *functionDecl ) { 264 264 functionDecl->set_functionType( maybeMutate( functionDecl->get_functionType(), *this ) ); 265 mutateAll( functionDecl->get_oldDecls(), *this );266 265 ++functionNesting; 267 266 functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) ); -
src/InitTweak/FixInit.cc
rf51ef6f r317450e 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Jul 12 17:41:15 201613 // Update Count : 3 412 // Last Modified On : Thu Feb 16 14:58:43 2017 13 // Update Count : 35 14 14 // 15 15 … … 839 839 void handleFuncDecl( FunctionDecl * funcDecl, Visitor & visitor ) { 840 840 maybeAccept( funcDecl->get_functionType(), visitor ); 841 acceptAll( funcDecl->get_oldDecls(), visitor );842 841 maybeAccept( funcDecl->get_statements(), visitor ); 843 842 } -
src/InitTweak/GenInit.cc
rf51ef6f r317450e 9 9 // Author : Rob Schluntz 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri May 13 11:37:48 201613 // Update Count : 16 611 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 16 14:57:53 2017 13 // Update Count : 167 14 14 // 15 15 … … 320 320 } 321 321 // parameters should not be constructed and destructed, so don't mutate FunctionType 322 mutateAll( functionDecl->get_oldDecls(), *this );323 322 functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) ); 324 323 -
src/Parser/DeclarationNode.cc
rf51ef6f r317450e 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 9 15:54:59201713 // Update Count : 7 4212 // Last Modified On : Thu Feb 16 13:06:50 2017 13 // Update Count : 753 14 14 // 15 15 … … 913 913 SemanticError errors; 914 914 std::back_insert_iterator< std::list< Declaration * > > out( outputList ); 915 const DeclarationNode * cur = firstNode; 916 917 while ( cur ) { 915 916 for ( const DeclarationNode * cur = firstNode; cur; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ) ) { 918 917 try { 919 918 if ( DeclarationNode * extr = cur->extractAggregate() ) { … … 936 935 errors.append( e ); 937 936 } // try 938 cur = dynamic_cast< DeclarationNode * >( cur->get_next() );939 937 } // while 940 938 … … 947 945 SemanticError errors; 948 946 std::back_insert_iterator< std::list< DeclarationWithType * > > out( outputList ); 949 const DeclarationNode * cur = firstNode;950 while ( cur) {947 948 for ( const DeclarationNode * cur = firstNode; cur; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ) ) { 951 949 try { 952 950 Declaration * decl = cur->build(); … … 972 970 errors.append( e ); 973 971 } // try 974 cur = dynamic_cast< DeclarationNode * >( cur->get_next() );975 } // while 972 } // for 973 976 974 if ( ! errors.isEmpty() ) { 977 975 throw errors; -
src/Parser/ParseNode.h
rf51ef6f r317450e 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 9 14:45:28201713 // Update Count : 6 5812 // Last Modified On : Thu Feb 16 13:15:55 2017 13 // Update Count : 661 14 14 // 15 15 … … 437 437 template< typename SynTreeType, typename NodeType > 438 438 void buildMoveList( const NodeType * firstNode, std::list< SynTreeType * > &outputList ) { 439 buildList( firstNode, outputList);439 buildList( firstNode, outputList ); 440 440 delete firstNode; 441 441 } -
src/Parser/TypeData.cc
rf51ef6f r317450e 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jan 27 15:28:56201713 // Update Count : 4 2812 // Last Modified On : Thu Feb 16 15:06:59 2017 13 // Update Count : 455 14 14 // 15 15 … … 724 724 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 725 if ( td->kind == TypeData::Function ) { 726 if ( td->function.idList ) { 727 buildKRFunction( td->function ); 728 } // if 729 726 730 FunctionDecl * decl; 727 731 if ( td->function.hasBody ) { … … 738 742 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), nullptr, isInline, isNoreturn, attributes ); 739 743 } // if 740 for ( DeclarationNode * cur = td->function.idList; cur != nullptr; cur = dynamic_cast< DeclarationNode* >( cur->get_next() ) ) {741 if ( cur->name ) {742 decl->get_oldIdents().insert( decl->get_oldIdents().end(), *cur->name );743 } // if744 } // for745 buildList( td->function.oldDeclList, decl->get_oldDecls() );746 744 return decl->set_asmName( asmName ); 747 745 } else if ( td->kind == TypeData::Aggregate ) { … … 778 776 } // buildFunction 779 777 778 void buildKRFunction( const TypeData::Function_t & function ) { 779 assert( ! function.params ); 780 for ( DeclarationNode * decl = function.oldDeclList; decl != nullptr; decl = dynamic_cast< DeclarationNode* >( decl->get_next() ) ) { 781 for ( DeclarationNode * param = function.idList; param != nullptr; param = dynamic_cast< DeclarationNode* >( param->get_next() ) ) { 782 if ( *decl->name == *param->name ) { 783 if ( param->type ) throw SemanticError( string( "duplicate declaration name " ) + *param->name ); 784 if ( ! decl->type ) throw SemanticError( string( "duplicate parameter name " ) + *param->name ); 785 param->type = decl->type; 786 decl->type = nullptr; 787 param->attributes.splice( param->attributes.end(), decl->attributes ); 788 } // if 789 } // for 790 if ( decl->type ) throw SemanticError( string( "missing name in parameter list " ) + *decl->name ); 791 } // for 792 for ( DeclarationNode * param = function.idList; param != nullptr; param = dynamic_cast< DeclarationNode* >( param->get_next() ) ) { 793 if ( ! param->type ) { 794 param->type = new TypeData( TypeData::Basic ); 795 param->type->basictype = DeclarationNode::Int; 796 } // if 797 } // for 798 799 function.params = function.idList; 800 function.idList = nullptr; 801 delete function.oldDeclList; 802 function.oldDeclList = nullptr; 803 } // buildKRFunction 804 780 805 // Local Variables: // 781 806 // tab-width: 4 // -
src/Parser/TypeData.h
rf51ef6f r317450e 10 10 // Created On : Sat May 16 15:18:36 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 2 17:02:09201713 // Update Count : 1 4612 // Last Modified On : Thu Feb 16 14:30:05 2017 13 // Update Count : 153 14 14 // 15 15 … … 52 52 53 53 struct Function_t { 54 DeclarationNode * params;55 DeclarationNode * idList;// old-style56 DeclarationNode * oldDeclList;54 mutable DeclarationNode * params; // mutables modified in buildKRFunction 55 mutable DeclarationNode * idList; // old-style 56 mutable DeclarationNode * oldDeclList; 57 57 StatementNode * body; 58 58 bool hasBody; … … 113 113 Declaration * buildDecl( const TypeData *, const std::string &, DeclarationNode::StorageClass, Expression *, bool isInline, bool isNoreturn, LinkageSpec::Spec, ConstantExpr *asmName, Initializer * init = nullptr, std::list< class Attribute * > attributes = std::list< class Attribute * >() ); 114 114 FunctionType * buildFunction( const TypeData * ); 115 void buildKRFunction( const TypeData::Function_t & function ); 115 116 116 117 #endif // TYPEDATA_H -
src/SymTab/Autogen.cc
rf51ef6f r317450e 10 10 // Created On : Thu Mar 03 15:45:56 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 2 18:04:40 201713 // Update Count : 1 112 // Last Modified On : Thu Feb 16 15:02:50 2017 13 // Update Count : 13 14 14 // 15 15 … … 658 658 659 659 maybeAccept( functionDecl->get_functionType(), *this ); 660 acceptAll( functionDecl->get_oldDecls(), *this );661 660 functionNesting += 1; 662 661 maybeAccept( functionDecl->get_statements(), *this ); … … 752 751 DeclarationWithType * AutogenTupleRoutines::mutate( FunctionDecl *functionDecl ) { 753 752 functionDecl->set_functionType( maybeMutate( functionDecl->get_functionType(), *this ) ); 754 mutateAll( functionDecl->get_oldDecls(), *this );755 753 functionNesting += 1; 756 754 functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) ); -
src/SymTab/Indexer.cc
rf51ef6f r317450e 10 10 // Created On : Sun May 17 21:37:33 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Jul 12 17:47:47 201613 // Update Count : 1 212 // Last Modified On : Thu Feb 16 14:59:19 2017 13 // Update Count : 13 14 14 // 15 15 … … 236 236 enterScope(); 237 237 maybeAccept( functionDecl->get_functionType(), *this ); 238 acceptAll( functionDecl->get_oldDecls(), *this );239 238 maybeAccept( functionDecl->get_statements(), *this ); 240 239 leaveScope(); -
src/SynTree/Declaration.h
rf51ef6f r317450e 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 9 14:27:08201713 // Update Count : 5 612 // Last Modified On : Thu Feb 16 14:53:35 2017 13 // Update Count : 57 14 14 // 15 15 … … 140 140 CompoundStmt *get_statements() const { return statements; } 141 141 void set_statements( CompoundStmt *newValue ) { statements = newValue; } 142 std::list< std::string >& get_oldIdents() { return oldIdents; }143 std::list< Declaration* >& get_oldDecls() { return oldDecls; }144 142 145 143 virtual FunctionDecl *clone() const { return new FunctionDecl( *this ); } … … 151 149 FunctionType *type; 152 150 CompoundStmt *statements; 153 std::list< std::string > oldIdents;154 std::list< Declaration* > oldDecls;155 151 }; 156 152 -
src/SynTree/FunctionDecl.cc
rf51ef6f r317450e 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Oct 1 23:06:32 201613 // Update Count : 2 112 // Last Modified On : Thu Feb 16 15:01:52 2017 13 // Update Count : 23 14 14 // 15 15 … … 44 44 delete type; 45 45 delete statements; 46 deleteAll( oldDecls );47 46 } 48 47 … … 84 83 } // if 85 84 86 if ( ! oldIdents.empty() ) {87 os << string( indent + 2, ' ' ) << "with parameter names" << endl;88 for ( std::list< std::string >::const_iterator i = oldIdents.begin(); i != oldIdents.end(); ++i ) {89 os << string( indent + 4, ' ' ) << *i << endl;90 } // for91 } // if92 93 if ( ! oldDecls.empty() ) {94 os << string( indent + 2, ' ' ) << "with parameter declarations" << endl;95 printAll( oldDecls, os, indent + 4 );96 } // if97 85 if ( statements ) { 98 86 os << string( indent + 2, ' ' ) << "with body " << endl; -
src/SynTree/Mutator.cc
rf51ef6f r317450e 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 9 14:22:56201713 // Update Count : 2 012 // Last Modified On : Thu Feb 16 15:02:23 2017 13 // Update Count : 21 14 14 // 15 15 … … 38 38 DeclarationWithType *Mutator::mutate( FunctionDecl *functionDecl ) { 39 39 functionDecl->set_functionType( maybeMutate( functionDecl->get_functionType(), *this ) ); 40 mutateAll( functionDecl->get_oldDecls(), *this );41 40 functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) ); 42 41 return functionDecl; -
src/SynTree/Visitor.cc
rf51ef6f r317450e 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 9 14:19:22201713 // Update Count : 2 212 // Last Modified On : Thu Feb 16 15:01:25 2017 13 // Update Count : 23 14 14 // 15 15 … … 35 35 void Visitor::visit( FunctionDecl *functionDecl ) { 36 36 maybeAccept( functionDecl->get_functionType(), *this ); 37 acceptAll( functionDecl->get_oldDecls(), *this );38 37 maybeAccept( functionDecl->get_statements(), *this ); 39 38 } -
src/tests/Makefile.am
rf51ef6f r317450e 11 11 ## Created On : Sun May 31 09:08:15 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Mon Feb 6 16:10:43201714 ## Update Count : 4 013 ## Last Modified On : Thu Feb 16 15:27:50 2017 14 ## Update Count : 41 15 15 ############################################################################### 16 16 … … 68 68 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 69 69 70 KRfunctions : KRfunctions.c 71 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 72 70 73 memberCtors-ERR1: memberCtors.c 71 74 ${CC} ${CFLAGS} -DERR1 ${<} -o ${@} -
src/tests/Makefile.in
rf51ef6f r317450e 689 689 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 690 690 691 KRfunctions : KRfunctions.c 692 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 693 691 694 memberCtors-ERR1: memberCtors.c 692 695 ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
Note: See TracChangeset
for help on using the changeset viewer.