Changeset f8b961b for src/GenPoly/Box.cc
- Timestamp:
- Dec 3, 2015, 4:37:27 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:
- 47534159
- Parents:
- 5bf4712
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
r5bf4712 rf8b961b 50 50 FunctionType *makeAdapterType( FunctionType *adaptee, const TyVarMap &tyVars ); 51 51 52 /// Replaces polymorphic return types with out-parameters, replaces calls to polymorphic functions with adapter calls as needed, and adds appropriate type variables to the function call 52 53 class Pass1 : public PolyMutator { 53 54 public: … … 88 89 }; 89 90 91 /// Moves polymorphic returns in function types to pointer-type parameters, adds type size and assertion parameters to parameter lists as well 90 92 class Pass2 : public PolyMutator { 91 93 public: … … 105 107 }; 106 108 109 /// Replaces initialization of polymorphic values with alloca, declaration of dtype/ftype with appropriate void expression, and sizeof expressions of polymorphic types with the proper variable 107 110 class Pass3 : public PolyMutator { 108 111 public: … … 1008 1011 std::list< DeclarationWithType *> inferredParams; 1009 1012 ObjectDecl *newObj = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0 ); 1010 // /ObjectDecl *newFunPtr = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ), 0 );1013 // ObjectDecl *newFunPtr = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ), 0 ); 1011 1014 for ( std::list< TypeDecl *>::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) { 1012 1015 ObjectDecl *thisParm; … … 1020 1023 // move all assertions into parameter list 1021 1024 for ( std::list< DeclarationWithType *>::iterator assert = (*tyParm)->get_assertions().begin(); assert != (*tyParm)->get_assertions().end(); ++assert ) { 1022 // /*assert = (*assert)->acceptMutator( *this );1025 // *assert = (*assert)->acceptMutator( *this ); 1023 1026 inferredParams.push_back( *assert ); 1024 1027 } … … 1062 1065 1063 1066 TypeDecl * Pass3::mutate( TypeDecl *typeDecl ) { 1064 // /Initializer *init = 0;1065 // /std::list< Expression *> designators;1066 // /scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();1067 // /if ( typeDecl->get_base() ) {1068 // /init = new SimpleInit( new SizeofExpr( handleDecl( typeDecl, typeDecl->get_base() ) ), designators );1069 // /}1070 // /return new ObjectDecl( typeDecl->get_name(), Declaration::Extern, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::UnsignedInt ), init );1067 // Initializer *init = 0; 1068 // std::list< Expression *> designators; 1069 // scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind(); 1070 // if ( typeDecl->get_base() ) { 1071 // init = new SimpleInit( new SizeofExpr( handleDecl( typeDecl, typeDecl->get_base() ) ), designators ); 1072 // } 1073 // return new ObjectDecl( typeDecl->get_name(), Declaration::Extern, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::UnsignedInt ), init ); 1071 1074 1072 1075 scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
Note: See TracChangeset
for help on using the changeset viewer.