Changeset 839ccbb
- Timestamp:
- Nov 20, 2015, 4:19:13 PM (9 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:
- 5189888
- Parents:
- 05587c2 (diff), ed94eac (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. - git-author:
- Peter A. Buhr <pabuhr@…> (11/20/15 12:51:58)
- git-committer:
- Peter A. Buhr <pabuhr@…> (11/20/15 16:19:13)
- Location:
- src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/GenPoly/InstantiateGeneric.cc ¶
r05587c2 r839ccbb 219 219 StructDecl *concDecl = instantiations.lookup( inst ); 220 220 if ( ! concDecl ) { 221 assert( inst->get_baseParameters() && "Base struct has parameters" ); 221 222 // set concDecl to new type, insert type declaration into statements to add 222 223 concDecl = new StructDecl( typeNamer.newName( inst->get_name() ) ); 223 224 substituteMembers( inst->get_baseStruct()->get_members(), 224 inst->get_baseParameters(), inst->get_parameters(),225 *inst->get_baseParameters(), inst->get_parameters(), 225 226 concDecl->get_members() ); 226 227 addDeclaration( concDecl ); … … 246 247 if ( ! concDecl ) { 247 248 // set concDecl to new type, insert type declaration into statements to add 249 assert( inst->get_baseParameters() && "Base union has parameters" ); 248 250 concDecl = new UnionDecl( typeNamer.newName( inst->get_name() ) ); 249 251 substituteMembers( inst->get_baseUnion()->get_members(), 250 inst->get_baseParameters(), inst->get_parameters(),252 *inst->get_baseParameters(), inst->get_parameters(), 251 253 concDecl->get_members() ); 252 254 addDeclaration( concDecl ); -
TabularUnified src/SymTab/Validate.cc ¶
r05587c2 r839ccbb 10 10 // Created On : Sun May 17 21:50:04 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Aug 11 16:59:35201513 // Update Count : 19 612 // Last Modified On : Thu Nov 19 22:31:41 2015 13 // Update Count : 197 14 14 // 15 15 … … 195 195 acceptAll( translationUnit, pass1 ); 196 196 acceptAll( translationUnit, pass2 ); 197 // need to collect all of the assignment operators prior to 198 // this point and only generate assignment operators ifone doesn't exist197 // need to collect all of the assignment operators prior to this point and only generate assignment operators if 198 // one doesn't exist 199 199 AddStructAssignment::addStructAssignment( translationUnit ); 200 200 acceptAll( translationUnit, pass3 ); -
TabularUnified src/SynTree/Mutator.h ¶
r05587c2 r839ccbb 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 23 23:24:18201513 // Update Count : 712 // Last Modified On : Thu Nov 19 22:26:16 2015 13 // Update Count : 8 14 14 // 15 15 #include <cassert> … … 103 103 inline TreeType *maybeMutate( TreeType *tree, MutatorType &mutator ) { 104 104 if ( tree ) { 105 TreeType *newnode = dynamic_cast< TreeType * >( tree->acceptMutator( mutator ) );105 TreeType *newnode = dynamic_cast< TreeType * >( tree->acceptMutator( mutator ) ); 106 106 assert( newnode ); 107 107 return newnode; -
TabularUnified src/SynTree/ReferenceToType.cc ¶
r05587c2 r839ccbb 59 59 std::string StructInstType::typeString() const { return "struct"; } 60 60 61 std::list<TypeDecl*>& StructInstType::get_baseParameters() { return baseStruct->get_parameters(); } 61 std::list<TypeDecl*>* StructInstType::get_baseParameters() { 62 if ( ! baseStruct ) return NULL; 63 return &baseStruct->get_parameters(); 64 } 62 65 63 66 void StructInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const { … … 68 71 std::string UnionInstType::typeString() const { return "union"; } 69 72 70 std::list<TypeDecl*>& UnionInstType::get_baseParameters() { return baseUnion->get_parameters(); } 73 std::list<TypeDecl*>* UnionInstType::get_baseParameters() { 74 if ( ! baseUnion ) return NULL; 75 return &baseUnion->get_parameters(); 76 } 71 77 72 78 void UnionInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const { -
TabularUnified src/SynTree/Type.h ¶
r05587c2 r839ccbb 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 9 16:46:15201513 // Update Count : 1 412 // Last Modified On : Fri Nov 20 12:54:09 2015 13 // Update Count : 15 14 14 // 15 15 … … 201 201 std::list<DeclarationWithType*> parameters; 202 202 203 // does the function accept a variable number of arguments following the arguments204 // specified in the parameters list.This could be because of203 // Does the function accept a variable number of arguments following the arguments specified in the parameters list. 204 // This could be because of 205 205 // - an ellipsis in a prototype declaration 206 206 // - an unprototyped declaration … … 238 238 void set_baseStruct( StructDecl *newValue ) { baseStruct = newValue; } 239 239 240 /// Accesses generic parameters of base struct 241 std::list<TypeDecl*> &get_baseParameters();240 /// Accesses generic parameters of base struct (NULL if none such) 241 std::list<TypeDecl*> * get_baseParameters(); 242 242 243 243 /// Looks up the members of this struct named "name" and places them into "foundDecls". … … 265 265 void set_baseUnion( UnionDecl *newValue ) { baseUnion = newValue; } 266 266 267 /// Accesses generic parameters of base union 268 std::list<TypeDecl*> &get_baseParameters();267 /// Accesses generic parameters of base union (NULL if none such) 268 std::list<TypeDecl*> * get_baseParameters(); 269 269 270 270 /// looks up the members of this union named "name" and places them into "foundDecls" -
TabularUnified src/SynTree/TypeSubstitution.cc ¶
r05587c2 r839ccbb 147 147 } // if 148 148 // bind type variables from generic type instantiations 149 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_baseParameters().begin(); tyvar != type->get_baseParameters().end(); ++tyvar ) { 150 boundVars.insert( (*tyvar)->get_name() ); 151 } // for 149 std::list< TypeDecl* > *baseParameters = type->get_baseParameters(); 150 if ( baseParameters && ! type->get_parameters().empty() ) { 151 for ( std::list< TypeDecl* >::const_iterator tyvar = baseParameters->begin(); tyvar != baseParameters->end(); ++tyvar ) { 152 boundVars.insert( (*tyvar)->get_name() ); 153 } // for 154 } // if 152 155 Type *ret = Mutator::mutate( type ); 153 156 boundVars = oldBoundVars; -
TabularUnified src/examples/Makefile.am ¶
r05587c2 r839ccbb 11 11 ## Created On : Sun May 31 09:08:15 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Thu Nov 19 18:01:56 201514 ## Update Count : 2 313 ## Last Modified On : Fri Nov 20 16:03:46 2015 14 ## Update Count : 24 15 15 ############################################################################### 16 16 … … 19 19 CC = @CFA_BINDIR@/cfa 20 20 21 noinst_PROGRAMS = fstream_test vector_test 21 noinst_PROGRAMS = fstream_test vector_test # build but do not install 22 22 fstream_test_SOURCES = iostream.c fstream.c fstream_test.c iterator.c 23 23 vector_test_SOURCES = vector_int.c fstream.c iostream.c array.c iterator.c vector_test.c -
TabularUnified src/examples/fstream.c ¶
r05587c2 r839ccbb 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:12:33201513 // Update Count : 212 // Last Modified On : Thu Nov 19 22:43:31 2015 13 // Update Count : 4 14 14 // 15 15 … … 30 30 fwrite( data, size, 1, os->file ); 31 31 os->fail = ferror( os->file ); 32 } 32 } // if 33 33 return os; 34 } 34 } // write 35 35 36 36 int fail( ofstream *os ) { 37 37 return os->fail; 38 } 38 } // fail 39 39 40 40 static ofstream *make_ofstream() { … … 42 42 new_stream->fail = 0; 43 43 return new_stream; 44 } 44 } // make_ofstream 45 45 46 46 ofstream *ofstream_stdout() { … … 48 48 stdout_stream->file = stdout; 49 49 return stdout_stream; 50 } 50 } // ofstream_stdout 51 51 52 52 ofstream *ofstream_stderr() { … … 54 54 stderr_stream->file = stderr; 55 55 return stderr_stream; 56 } 56 } // ofstream_stderr 57 57 58 58 ofstream *ofstream_fromfile( const char *name ) { -
TabularUnified src/examples/hello.c ¶
r05587c2 r839ccbb 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:14:58201513 // Update Count : 112 // Last Modified On : Fri Nov 20 16:02:50 2015 13 // Update Count : 3 14 14 // 15 15 … … 28 28 // Local Variables: // 29 29 // tab-width: 4 // 30 // compile-command: "cfa hello.c fstream.o iostream.o " //30 // compile-command: "cfa hello.c fstream.o iostream.o iterator.o" // 31 31 // End: // -
TabularUnified src/examples/iostream.c ¶
r05587c2 r839ccbb 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Nov 19 17:54:38201513 // Update Count : 412 // Last Modified On : Fri Nov 20 13:19:19 2015 13 // Update Count : 9 14 14 // 15 15 … … 17 17 extern "C" { 18 18 #include <stdio.h> 19 //#include <string.h> 20 //#include <ctype.h> 21 typedef long unsigned int size_t; 22 size_t strlen(const char *s); 19 #include <string.h> // strlen 23 20 } 24 21 … … 26 23 ostype * ?<<?( ostype *os, char c ) { 27 24 return write( os, &c, 1 ); 28 } 25 } // ?<<? 29 26 30 27 forall( dtype ostype | ostream( ostype ) ) … … 33 30 sprintf( buffer, "%d", i ); 34 31 return write( os, buffer, strlen( buffer ) ); 35 } 32 } // ?<<? 36 33 37 34 forall( dtype ostype | ostream( ostype ) ) … … 40 37 sprintf( buffer, "%g", d ); 41 38 return write( os, buffer, strlen( buffer ) ); 42 } 39 } // ?<<? 43 40 44 41 forall( dtype ostype | ostream( ostype ) ) 45 42 ostype * ?<<?( ostype *os, const char *cp ) { 46 43 return write( os, cp, strlen( cp ) ); 47 } 44 } // ?<<? 48 45 49 46 forall( dtype ostype | ostream( ostype ) ) … … 52 49 sprintf( buffer, "%p", p ); 53 50 return write( os, buffer, strlen( buffer ) ); 54 } 51 } // ?<<? 55 52 56 53 forall( type elt_type | writeable( elt_type ), … … 62 59 } 63 60 for_each( begin, end, print ); 64 } 61 } // ?<<? 65 62 66 63 forall( type elt_type | writeable( elt_type ), … … 72 69 } 73 70 for_each_reverse( begin, end, print ); 74 } 71 } // ?<<? 75 72 76 73 … … 78 75 istype * ?>>?( istype *is, char *cp ) { 79 76 return read( is, cp, 1 ); 80 } 77 } // ?>>? 81 78 82 79 forall( dtype istype | istream( istype ) ) … … 100 97 unread( is, cur ); 101 98 return is; 102 } 99 } // ?>>? 103 100 104 101 // Local Variables: // -
TabularUnified src/main.cc ¶
r05587c2 r839ccbb 9 9 // Author : Richard C. Bilson 10 10 // Created On : Fri May 15 23:12:02 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Thu Jul 30 16:08:18201513 // Update Count : 16 711 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Nov 19 22:31:40 2015 13 // Update Count : 168 14 14 // 15 15 … … 227 227 } // if 228 228 229 // add the assignment statement after the 230 // initialization of a type parameter 229 // add the assignment statement after the initialization of a type parameter 231 230 OPTPRINT( "validate" ) 232 231 SymTab::validate( translationUnit, symtabp );
Note: See TracChangeset
for help on using the changeset viewer.