Changes in / [05587c2:e56cfdb0]
- Location:
- src
- Files:
-
- 2 deleted
- 9 edited
-
GenPoly/InstantiateGeneric.cc (deleted)
-
GenPoly/InstantiateGeneric.h (deleted)
-
GenPoly/module.mk (modified) (1 diff)
-
Makefile.in (modified) (6 diffs)
-
Parser/TypeData.cc (modified) (1 diff)
-
SymTab/Validate.cc (modified) (1 diff)
-
SynTree/ReferenceToType.cc (modified) (2 diffs)
-
SynTree/Type.h (modified) (2 diffs)
-
SynTree/TypeSubstitution.cc (modified) (3 diffs)
-
SynTree/TypeSubstitution.h (modified) (1 diff)
-
main.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/module.mk
r05587c2 re56cfdb0 22 22 GenPoly/Specialize.cc \ 23 23 GenPoly/CopyParams.cc \ 24 GenPoly/FindFunction.cc \ 25 GenPoly/InstantiateGeneric.cc 24 GenPoly/FindFunction.cc -
src/Makefile.in
r05587c2 re56cfdb0 121 121 GenPoly/cfa_cpp-CopyParams.$(OBJEXT) \ 122 122 GenPoly/cfa_cpp-FindFunction.$(OBJEXT) \ 123 GenPoly/cfa_cpp-InstantiateGeneric.$(OBJEXT) \124 123 InitTweak/cfa_cpp-InitModel.$(OBJEXT) \ 125 124 InitTweak/cfa_cpp-InitExpander.$(OBJEXT) \ … … 348 347 GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc GenPoly/Specialize.cc \ 349 348 GenPoly/CopyParams.cc GenPoly/FindFunction.cc \ 350 GenPoly/InstantiateGeneric.cc InitTweak/InitModel.cc \351 InitTweak/ InitExpander.cc InitTweak/Mutate.cc \352 InitTweak/ Association.cc InitTweak/RemoveInit.cc\353 Parser/ parser.yy Parser/lex.ll Parser/TypedefTable.cc \354 Parser/ ParseNode.cc Parser/DeclarationNode.cc \355 Parser/ ExpressionNode.cc Parser/StatementNode.cc \356 Parser/ InitializerNode.cc Parser/TypeData.cc \357 Parser/ LinkageSpec.cc Parser/parseutility.cc Parser/Parser.cc \349 InitTweak/InitModel.cc InitTweak/InitExpander.cc \ 350 InitTweak/Mutate.cc InitTweak/Association.cc \ 351 InitTweak/RemoveInit.cc Parser/parser.yy Parser/lex.ll \ 352 Parser/TypedefTable.cc Parser/ParseNode.cc \ 353 Parser/DeclarationNode.cc Parser/ExpressionNode.cc \ 354 Parser/StatementNode.cc Parser/InitializerNode.cc \ 355 Parser/TypeData.cc Parser/LinkageSpec.cc \ 356 Parser/parseutility.cc Parser/Parser.cc \ 358 357 ResolvExpr/AlternativeFinder.cc ResolvExpr/Alternative.cc \ 359 358 ResolvExpr/Unify.cc ResolvExpr/PtrsAssignable.cc \ … … 554 553 GenPoly/$(DEPDIR)/$(am__dirstamp) 555 554 GenPoly/cfa_cpp-FindFunction.$(OBJEXT): GenPoly/$(am__dirstamp) \ 556 GenPoly/$(DEPDIR)/$(am__dirstamp)557 GenPoly/cfa_cpp-InstantiateGeneric.$(OBJEXT): GenPoly/$(am__dirstamp) \558 555 GenPoly/$(DEPDIR)/$(am__dirstamp) 559 556 InitTweak/$(am__dirstamp): … … 787 784 -rm -f GenPoly/cfa_cpp-FindFunction.$(OBJEXT) 788 785 -rm -f GenPoly/cfa_cpp-GenPoly.$(OBJEXT) 789 -rm -f GenPoly/cfa_cpp-InstantiateGeneric.$(OBJEXT)790 786 -rm -f GenPoly/cfa_cpp-Lvalue.$(OBJEXT) 791 787 -rm -f GenPoly/cfa_cpp-PolyMutator.$(OBJEXT) … … 897 893 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/cfa_cpp-FindFunction.Po@am__quote@ 898 894 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/cfa_cpp-GenPoly.Po@am__quote@ 899 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/cfa_cpp-InstantiateGeneric.Po@am__quote@900 895 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/cfa_cpp-Lvalue.Po@am__quote@ 901 896 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/cfa_cpp-PolyMutator.Po@am__quote@ … … 1362 1357 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/cfa_cpp-FindFunction.obj `if test -f 'GenPoly/FindFunction.cc'; then $(CYGPATH_W) 'GenPoly/FindFunction.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/FindFunction.cc'; fi` 1363 1358 1364 GenPoly/cfa_cpp-InstantiateGeneric.o: GenPoly/InstantiateGeneric.cc1365 @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/cfa_cpp-InstantiateGeneric.o -MD -MP -MF GenPoly/$(DEPDIR)/cfa_cpp-InstantiateGeneric.Tpo -c -o GenPoly/cfa_cpp-InstantiateGeneric.o `test -f 'GenPoly/InstantiateGeneric.cc' || echo '$(srcdir)/'`GenPoly/InstantiateGeneric.cc1366 @am__fastdepCXX_TRUE@ $(am__mv) GenPoly/$(DEPDIR)/cfa_cpp-InstantiateGeneric.Tpo GenPoly/$(DEPDIR)/cfa_cpp-InstantiateGeneric.Po1367 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='GenPoly/InstantiateGeneric.cc' object='GenPoly/cfa_cpp-InstantiateGeneric.o' libtool=no @AMDEPBACKSLASH@1368 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@1369 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/cfa_cpp-InstantiateGeneric.o `test -f 'GenPoly/InstantiateGeneric.cc' || echo '$(srcdir)/'`GenPoly/InstantiateGeneric.cc1370 1371 GenPoly/cfa_cpp-InstantiateGeneric.obj: GenPoly/InstantiateGeneric.cc1372 @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/cfa_cpp-InstantiateGeneric.obj -MD -MP -MF GenPoly/$(DEPDIR)/cfa_cpp-InstantiateGeneric.Tpo -c -o GenPoly/cfa_cpp-InstantiateGeneric.obj `if test -f 'GenPoly/InstantiateGeneric.cc'; then $(CYGPATH_W) 'GenPoly/InstantiateGeneric.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/InstantiateGeneric.cc'; fi`1373 @am__fastdepCXX_TRUE@ $(am__mv) GenPoly/$(DEPDIR)/cfa_cpp-InstantiateGeneric.Tpo GenPoly/$(DEPDIR)/cfa_cpp-InstantiateGeneric.Po1374 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='GenPoly/InstantiateGeneric.cc' object='GenPoly/cfa_cpp-InstantiateGeneric.obj' libtool=no @AMDEPBACKSLASH@1375 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@1376 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/cfa_cpp-InstantiateGeneric.obj `if test -f 'GenPoly/InstantiateGeneric.cc'; then $(CYGPATH_W) 'GenPoly/InstantiateGeneric.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/InstantiateGeneric.cc'; fi`1377 1378 1359 InitTweak/cfa_cpp-InitModel.o: InitTweak/InitModel.cc 1379 1360 @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/cfa_cpp-InitModel.o -MD -MP -MF InitTweak/$(DEPDIR)/cfa_cpp-InitModel.Tpo -c -o InitTweak/cfa_cpp-InitModel.o `test -f 'InitTweak/InitModel.cc' || echo '$(srcdir)/'`InitTweak/InitModel.cc -
src/Parser/TypeData.cc
r05587c2 re56cfdb0 799 799 case DeclarationNode::Struct: 800 800 at = new StructDecl( aggregate->name ); 801 buildForall( aggregate->params, at->get_parameters() );802 801 break; 803 802 case DeclarationNode::Union: 804 803 at = new UnionDecl( aggregate->name ); 805 buildForall( aggregate->params, at->get_parameters() );806 804 break; 807 805 case DeclarationNode::Context: 808 806 at = new ContextDecl( aggregate->name ); 809 buildList( aggregate->params, at->get_parameters() );810 807 break; 811 808 default: 812 809 assert( false ); 813 810 } // switch 814 //buildList( aggregate->params, at->get_parameters() );811 buildList( aggregate->params, at->get_parameters() ); 815 812 buildList( aggregate->fields, at->get_members() ); 816 813 -
src/SymTab/Validate.cc
r05587c2 re56cfdb0 629 629 Declaration *makeStructAssignment( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting ) { 630 630 FunctionType *assignType = new FunctionType( Type::Qualifiers(), false ); 631 632 // Make function polymorphic in same parameters as generic struct, if applicable633 std::list< TypeDecl* >& genericParams = aggregateDecl->get_parameters();634 for ( std::list< TypeDecl* >::const_iterator param = genericParams.begin(); param != genericParams.end(); ++param ) {635 assignType->get_forall().push_back( (*param)->clone() );636 }637 631 638 632 ObjectDecl *returnVal = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, refType->clone(), 0 ); -
src/SynTree/ReferenceToType.cc
r05587c2 re56cfdb0 59 59 std::string StructInstType::typeString() const { return "struct"; } 60 60 61 std::list<TypeDecl*>& StructInstType::get_baseParameters() { return baseStruct->get_parameters(); }62 63 61 void StructInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const { 64 62 assert( baseStruct ); … … 67 65 68 66 std::string UnionInstType::typeString() const { return "union"; } 69 70 std::list<TypeDecl*>& UnionInstType::get_baseParameters() { return baseUnion->get_parameters(); }71 67 72 68 void UnionInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const { -
src/SynTree/Type.h
r05587c2 re56cfdb0 237 237 StructDecl *get_baseStruct() const { return baseStruct; } 238 238 void set_baseStruct( StructDecl *newValue ) { baseStruct = newValue; } 239 240 /// Accesses generic parameters of base struct 241 std::list<TypeDecl*>& get_baseParameters(); 242 243 /// Looks up the members of this struct named "name" and places them into "foundDecls". 244 /// Clones declarations into "foundDecls", caller responsible for freeing 239 240 // a utility function 245 241 void lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const; 246 242 … … 264 260 UnionDecl *get_baseUnion() const { return baseUnion; } 265 261 void set_baseUnion( UnionDecl *newValue ) { baseUnion = newValue; } 266 267 /// Accesses generic parameters of base union 268 std::list<TypeDecl*>& get_baseParameters(); 269 270 /// looks up the members of this union named "name" and places them into "foundDecls" 271 /// Clones declarations into "foundDecls", caller responsible for freeing 262 263 // a utility function 272 264 void lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const; 273 265 -
src/SynTree/TypeSubstitution.cc
r05587c2 re56cfdb0 126 126 Type *TypeSubstitution::handleType( TypeClass *type ) { 127 127 BoundVarsType oldBoundVars( boundVars ); 128 // bind type variables from forall-qualifiers129 128 if ( freeOnly ) { 130 129 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) { … … 132 131 } // for 133 132 } // if 134 Type *ret = Mutator::mutate( type );135 boundVars = oldBoundVars;136 return ret;137 }138 139 template< typename TypeClass >140 Type *TypeSubstitution::handleAggregateType( TypeClass *type ) {141 BoundVarsType oldBoundVars( boundVars );142 // bind type variables from forall-qualifiers143 if ( freeOnly ) {144 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {145 boundVars.insert( (*tyvar )->get_name() );146 } // for147 } // if148 // bind type variables from generic type instantiations149 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_baseParameters().begin(); tyvar != type->get_baseParameters().end(); ++tyvar ) {150 boundVars.insert( (*tyvar)->get_name() );151 } // for152 133 Type *ret = Mutator::mutate( type ); 153 134 boundVars = oldBoundVars; … … 176 157 177 158 Type * TypeSubstitution::mutate( StructInstType *aggregateUseType ) { 178 return handle AggregateType( aggregateUseType );159 return handleType( aggregateUseType ); 179 160 } 180 161 181 162 Type * TypeSubstitution::mutate( UnionInstType *aggregateUseType ) { 182 return handle AggregateType( aggregateUseType );163 return handleType( aggregateUseType ); 183 164 } 184 165 -
src/SynTree/TypeSubstitution.h
r05587c2 re56cfdb0 58 58 virtual Type* mutate(TypeInstType *aggregateUseType); 59 59 virtual Expression* mutate(NameExpr *nameExpr); 60 61 /// Records type variable bindings from forall-statements 60 62 61 template< typename TypeClass > Type *handleType( TypeClass *type ); 63 /// Records type variable bindings from forall-statements and instantiations of generic types64 template< typename TypeClass > Type *handleAggregateType( TypeClass *type );65 62 66 63 virtual Type* mutate(VoidType *basicType); -
src/main.cc
r05587c2 re56cfdb0 24 24 #include "SynTree/Declaration.h" 25 25 #include "SynTree/Visitor.h" 26 #include "GenPoly/InstantiateGeneric.h"27 26 #include "GenPoly/Lvalue.h" 28 27 #include "GenPoly/Specialize.h" … … 269 268 } 270 269 271 OPTPRINT( "instantiateGeneric" )272 GenPoly::instantiateGeneric( translationUnit );273 270 OPTPRINT( "copyParams" ); 274 271 GenPoly::copyParams( translationUnit );
Note:
See TracChangeset
for help on using the changeset viewer.