Changeset fea7ca7
- Timestamp:
- Apr 29, 2016, 12:26:50 PM (8 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, with_gc
- Children:
- d8ba086
- Parents:
- a0fdbd5
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
ra0fdbd5 rfea7ca7 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Mon Apr 18 13:22:15201612 // Last Modified On : Fri Apr 29 12:16:11 2016 13 13 // Update Count : 295 14 14 // … … 911 911 } else if ( arg->get_results().front()->get_isLvalue() ) { 912 912 // VariableExpr and MemberExpr are lvalues; need to check this isn't coming from the second arg of a comma expression though (not an lvalue) 913 // xxx - need to test that this code is still reachable 913 914 if ( CommaExpr *commaArg = dynamic_cast< CommaExpr* >( arg ) ) { 914 915 commaArg->set_arg2( new AddressExpr( commaArg->get_arg2() ) ); … … 1346 1347 } // if 1347 1348 } // if 1349 // isPolyType check needs to happen before mutating addrExpr arg, so pull it forward 1350 // out of the if condition. 1351 bool polytype = isPolyType( addrExpr->get_arg()->get_results().front(), scopeTyVars, env ); 1348 1352 addrExpr->set_arg( mutateExpression( addrExpr->get_arg() ) ); 1349 if ( isPolyType( addrExpr->get_arg()->get_results().front(), scopeTyVars, env )|| needs ) {1353 if ( polytype || needs ) { 1350 1354 Expression *ret = addrExpr->get_arg(); 1351 1355 delete ret->get_results().front(); -
src/GenPoly/Specialize.cc
ra0fdbd5 rfea7ca7 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jan 20 13:00:00201612 // Last Modified On : Thu Apr 28 15:17:45 2016 13 13 // Update Count : 24 14 14 // … … 41 41 virtual Expression * mutate( AddressExpr *castExpr ); 42 42 virtual Expression * mutate( CastExpr *castExpr ); 43 virtual Expression * mutate( LogicalExpr *logicalExpr );44 virtual Expression * mutate( ConditionalExpr *conditionalExpr );45 virtual Expression * mutate( CommaExpr *commaExpr );43 // virtual Expression * mutate( LogicalExpr *logicalExpr ); 44 // virtual Expression * mutate( ConditionalExpr *conditionalExpr ); 45 // virtual Expression * mutate( CommaExpr *commaExpr ); 46 46 47 47 private: … … 212 212 } 213 213 214 Expression * Specialize::mutate( LogicalExpr *logicalExpr ) { 215 return logicalExpr; 216 } 217 218 Expression * Specialize::mutate( ConditionalExpr *condExpr ) { 219 return condExpr; 220 } 221 222 Expression * Specialize::mutate( CommaExpr *commaExpr ) { 223 return commaExpr; 224 } 214 // Removing these for now. Richard put these in for some reason, but it's not clear why. 215 // In particular, copy constructors produce a comma expression, and with this code the parts 216 // of that comma expression are not specialized, which causes problems. 217 218 // Expression * Specialize::mutate( LogicalExpr *logicalExpr ) { 219 // return logicalExpr; 220 // } 221 222 // Expression * Specialize::mutate( ConditionalExpr *condExpr ) { 223 // return condExpr; 224 // } 225 226 // Expression * Specialize::mutate( CommaExpr *commaExpr ) { 227 // return commaExpr; 228 // } 225 229 } // namespace GenPoly 226 230 -
src/InitTweak/FixInit.cc
ra0fdbd5 rfea7ca7 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Apr 28 12:25:14201612 // Last Modified On : Fri Apr 29 12:25:40 2016 13 13 // Update Count : 30 14 14 // … … 231 231 callExpr->set_env( impCpCtorExpr->get_env()->clone() ); 232 232 for ( Type * result : appExpr->get_results() ) { 233 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, result->clone(), 0 ); 233 result = result->clone(); 234 impCpCtorExpr->get_env()->apply( result ); 235 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, result, 0 ); 234 236 ret->get_type()->set_isConst( false ); 235 237 impCpCtorExpr->get_returnDecls().push_back( ret ); … … 285 287 // add that onto the assignment expression so that later steps have the necessary information 286 288 assign->add_result( returnDecl->get_type()->clone() ); 287 // return new CommaExpr( assign, new VariableExpr( returnDecl ) ); 288 return assign; 289 290 Expression * retExpr = new CommaExpr( assign, new VariableExpr( returnDecl ) ); 291 if ( callExpr->get_results().front()->get_isLvalue() ) { 292 // lvalue returning functions are funny. Lvalue.cc inserts a *? in front of any 293 // lvalue returning non-intrinsic function. Add an AddressExpr to the call to negate 294 // the derefence and change the type of the return temporary from T to T* to properly 295 // capture the return value. Then dereference the result of the comma expression, since 296 // the lvalue returning call was originally wrapped with an AddressExpr. 297 // Effectively, this turns 298 // lvalue T f(); 299 // &*f() 300 // into 301 // T * tmp_cp_retN; 302 // tmp_cp_ret_N = &*(tmp_cp_ret_N = &*f(), tmp_cp_ret); 303 // which work out in terms of types, but is pretty messy. It would be nice to find a better way. 304 assign->get_args().back() = new AddressExpr( assign->get_args().back() ); 305 306 Type * resultType = returnDecl->get_type()->clone(); 307 returnDecl->set_type( new PointerType( Type::Qualifiers(), returnDecl->get_type() ) ); 308 UntypedExpr * deref = new UntypedExpr( new NameExpr( "*?" ) ); 309 deref->get_args().push_back( retExpr ); 310 deref->add_result( resultType ); 311 retExpr = deref; 312 } 313 return retExpr; 289 314 } else { 290 315 return callExpr; -
src/main.cc
ra0fdbd5 rfea7ca7 10 10 // Created On : Fri May 15 23:12:02 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Apr 28 12:24:46201612 // Last Modified On : Fri Apr 29 12:02:21 2016 13 13 // Update Count : 200 14 14 // … … 61 61 astp = false, 62 62 bresolvep = false, 63 bboxp = false, 63 64 ctorinitp = false, 64 65 exprp = false, … … 76 77 codegenp = false; 77 78 78 enum { Ast, B resolver, CtorInitFix, Expr, ExprAlt, Grammar, LibCFA, Nopreamble, Parse, Prototypes, Resolver, Symbol, Tree, Validate, };79 enum { Ast, Bbox, Bresolver, CtorInitFix, Expr, ExprAlt, Grammar, LibCFA, Nopreamble, Parse, Prototypes, Resolver, Symbol, Tree, Validate, }; 79 80 80 81 static struct option long_opts[] = { 81 82 { "ast", no_argument, 0, Ast }, 83 { "before-box", no_argument, 0, Bbox }, 82 84 { "before-resolver", no_argument, 0, Bresolver }, 83 85 { "ctorinitfix", no_argument, 0, CtorInitFix }, … … 105 107 106 108 int c; 107 while ( (c = getopt_long( argc, argv, "ab cefFglnpqrstvyzD:", long_opts, &long_index )) != -1 ) {109 while ( (c = getopt_long( argc, argv, "abBcefFglnpqrstvyzD:", long_opts, &long_index )) != -1 ) { 108 110 switch ( c ) { 109 111 case Ast: … … 115 117 bresolvep = true; 116 118 break; 117 case CtorInitFix: 118 case 'c': 119 case 'B': // print before resolver steps 120 bboxp = true; 121 break; 122 case CtorInitFix: 123 case 'c': 119 124 ctorinitp = true; 120 125 break; … … 292 297 OPTPRINT( "convertLvalue" ) 293 298 GenPoly::convertLvalue( translationUnit ); 299 300 if ( bboxp ) { 301 dump( translationUnit ); 302 return 0; 303 } 294 304 OPTPRINT( "box" ) 295 305 GenPoly::box( translationUnit );
Note: See TracChangeset
for help on using the changeset viewer.