- Timestamp:
- Sep 16, 2022, 11:19:04 AM (3 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation
- Children:
- 4407b7e
- Parents:
- 9a90092
- Location:
- src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Print.cpp
r9a90092 r09f34a84 33 33 { 34 34 return array<C,sizeof...(T)>{ 35 forward<T>(values)...35 std::forward<T>(values)... 36 36 }; 37 37 } -
src/AST/Type.cpp
r9a90092 r09f34a84 143 143 TraitInstType::TraitInstType( 144 144 const TraitDecl * b, CV::Qualifiers q, std::vector<ptr<Attribute>>&& as ) 145 : BaseInstType( b->name, q, move(as) ), base( b ) {}145 : BaseInstType( b->name, q, std::move(as) ), base( b ) {} 146 146 147 147 // --- TypeInstType … … 149 149 TypeInstType::TypeInstType( const TypeDecl * b, 150 150 CV::Qualifiers q, std::vector<ptr<Attribute>> && as ) 151 : BaseInstType( b->name, q, move(as) ), base( b ), kind( b->kind ) {}151 : BaseInstType( b->name, q, std::move(as) ), base( b ), kind( b->kind ) {} 152 152 153 153 void TypeInstType::set_base( const TypeDecl * b ) { … … 161 161 162 162 TupleType::TupleType( std::vector<ptr<Type>> && ts, CV::Qualifiers q ) 163 : Type( q ), types( move(ts) ), members() {163 : Type( q ), types( std::move(ts) ), members() { 164 164 // This constructor is awkward. `TupleType` needs to contain objects so that members can be 165 165 // named, but members without initializer nodes end up getting constructors, which breaks -
src/Concurrency/Keywords.cc
r9a90092 r09f34a84 508 508 ObjectDecl * vtable_object = Virtual::makeVtableForward( 509 509 "_default_vtable_object_declaration", 510 vtable_decl->makeInst( move( poly_args ) ) );510 vtable_decl->makeInst( std::move( poly_args ) ) ); 511 511 declsToAddBefore.push_back( vtable_object ); 512 512 declsToAddBefore.push_back( … … 681 681 void lock (monitor_t & this) { 682 682 lock(get_monitor(this)); 683 } 683 } 684 684 */ 685 685 FunctionDecl * lock_decl = new FunctionDecl( … … 700 700 CompoundStmt * lock_statement = new CompoundStmt(); 701 701 lock_statement->push_back( 702 new ExprStmt( 702 new ExprStmt( 703 703 new UntypedExpr ( 704 704 new NameExpr( "lock" ), … … 716 716 void unlock (monitor_t & this) { 717 717 unlock(get_monitor(this)); 718 } 718 } 719 719 */ 720 720 FunctionDecl * unlock_decl = new FunctionDecl( … … 736 736 737 737 unlock_statement->push_back( 738 new ExprStmt( 738 new ExprStmt( 739 739 new UntypedExpr( 740 740 new NameExpr( "unlock" ), … … 746 746 ); 747 747 unlock_decl->set_statements( unlock_statement ); 748 748 749 749 // pushes routines to declsToAddAfter to add at a later time 750 750 declsToAddAfter.push_back( lock_decl ); … … 1054 1054 assert( !thread_guard_decl ); 1055 1055 thread_guard_decl = decl; 1056 } 1056 } 1057 1057 else if ( decl->name == "__mutex_stmt_lock_guard" && decl->body ) { 1058 1058 assert( !lock_guard_decl ); … … 1206 1206 new NameExpr( "__get_mutexstmt_lock_type" ), 1207 1207 { args.front()->clone() } 1208 ) 1208 ) 1209 1209 ) 1210 1210 ), … … 1225 1225 1226 1226 StructInstType * lock_guard_struct = new StructInstType( noQualifiers, lock_guard_decl ); 1227 TypeExpr * lock_type_expr = new TypeExpr( 1227 TypeExpr * lock_type_expr = new TypeExpr( 1228 1228 new TypeofType( noQualifiers, new UntypedExpr( 1229 1229 new NameExpr( "__get_mutexstmt_lock_type" ), 1230 1230 { args.front()->clone() } 1231 ) 1232 ) 1231 ) 1232 ) 1233 1233 ); 1234 1234 -
src/Parser/parser.yy
r9a90092 r09f34a84 58 58 59 59 // lex uses __null in a boolean context, it's fine. 60 //#pragma GCC diagnostic ignored "-Wparentheses-equality" 60 #pragma GCC diagnostic ignored "-Wpragmas" 61 #pragma GCC diagnostic ignored "-Wparentheses-equality" 62 #pragma GCC diagnostic warning "-Wpragmas" 61 63 62 64 extern DeclarationNode * parseTree; -
src/ResolvExpr/CandidateFinder.cpp
r9a90092 r09f34a84 269 269 unsigned nextArg, unsigned tupleStart = 0, Cost cost = Cost::zero, 270 270 unsigned nextExpl = 0, unsigned explAlt = 0 ) 271 : parent(parent), expr( expr ), cost( cost ), env( move( env ) ), need(move( need ) ),272 have( move( have ) ), open(move( open ) ), nextArg( nextArg ), tupleStart( tupleStart ),271 : parent(parent), expr( expr ), cost( cost ), env( std::move( env ) ), need( std::move( need ) ), 272 have( std::move( have ) ), open( std::move( open ) ), nextArg( nextArg ), tupleStart( tupleStart ), 273 273 nextExpl( nextExpl ), explAlt( explAlt ) {} 274 274 … … 276 276 const ArgPack & o, ast::TypeEnvironment && env, ast::AssertionSet && need, 277 277 ast::AssertionSet && have, ast::OpenVarSet && open, unsigned nextArg, Cost added ) 278 : parent( o.parent ), expr( o.expr ), cost( o.cost + added ), env( move( env ) ),279 need( move( need ) ), have( move( have ) ), open(move( open ) ), nextArg( nextArg ),278 : parent( o.parent ), expr( o.expr ), cost( o.cost + added ), env( std::move( env ) ), 279 need( std::move( need ) ), have( std::move( have ) ), open( std::move( open ) ), nextArg( nextArg ), 280 280 tupleStart( o.tupleStart ), nextExpl( 0 ), explAlt( 0 ) {} 281 281 … … 301 301 // reset pack to appropriate tuple 302 302 std::vector< ast::ptr< ast::Expr > > exprv( exprs.begin(), exprs.end() ); 303 expr = new ast::TupleExpr{ expr->location, move( exprv ) };303 expr = new ast::TupleExpr{ expr->location, std::move( exprv ) }; 304 304 tupleStart = pack->tupleStart - 1; 305 305 parent = pack->parent; … … 404 404 newResult.open, symtab ) 405 405 ) { 406 finalResults.emplace_back( move( newResult ) );406 finalResults.emplace_back( std::move( newResult ) ); 407 407 } 408 408 … … 423 423 if ( expl.exprs.empty() ) { 424 424 results.emplace_back( 425 results[i], move( env ), copy( results[i].need ),426 copy( results[i].have ), move( open ), nextArg + 1, expl.cost );425 results[i], std::move( env ), copy( results[i].need ), 426 copy( results[i].have ), std::move( open ), nextArg + 1, expl.cost ); 427 427 428 428 continue; … … 431 431 // add new result 432 432 results.emplace_back( 433 i, expl.exprs.front(), move( env ), copy( results[i].need ),434 copy( results[i].have ), move( open ), nextArg + 1, nTuples,433 i, expl.exprs.front(), std::move( env ), copy( results[i].need ), 434 copy( results[i].have ), std::move( open ), nextArg + 1, nTuples, 435 435 expl.cost, expl.exprs.size() == 1 ? 0 : 1, j ); 436 436 } … … 444 444 // splice final results onto results 445 445 for ( std::size_t i = 0; i < finalResults.size(); ++i ) { 446 results.emplace_back( move( finalResults[i] ) );446 results.emplace_back( std::move( finalResults[i] ) ); 447 447 } 448 448 return ! finalResults.empty(); … … 478 478 479 479 results.emplace_back( 480 i, expr, move( env ), move( need ), move( have ),move( open ), nextArg,480 i, expr, std::move( env ), std::move( need ), std::move( have ), std::move( open ), nextArg, 481 481 nTuples, Cost::zero, nextExpl, results[i].explAlt ); 482 482 } … … 494 494 if ( unify( paramType, cnst->result, env, need, have, open, symtab ) ) { 495 495 results.emplace_back( 496 i, new ast::DefaultArgExpr{ cnst->location, cnst }, move( env ),497 move( need ), move( have ),move( open ), nextArg, nTuples );496 i, new ast::DefaultArgExpr{ cnst->location, cnst }, std::move( env ), 497 std::move( need ), std::move( have ), std::move( open ), nextArg, nTuples ); 498 498 } 499 499 } … … 516 516 if ( expl.exprs.empty() ) { 517 517 results.emplace_back( 518 results[i], move( env ), move( need ), move( have ),move( open ),518 results[i], std::move( env ), std::move( need ), std::move( have ), std::move( open ), 519 519 nextArg + 1, expl.cost ); 520 520 … … 538 538 // add new result 539 539 results.emplace_back( 540 i, expr, move( env ), move( need ), move( have ),move( open ),540 i, expr, std::move( env ), std::move( need ), std::move( have ), std::move( open ), 541 541 nextArg + 1, nTuples, expl.cost, expl.exprs.size() == 1 ? 0 : 1, j ); 542 542 } … … 576 576 restructureCast( idx, toType->getComponent( i ), isGenerated ) ); 577 577 } 578 return new ast::TupleExpr{ arg->location, move( components ) };578 return new ast::TupleExpr{ arg->location, std::move( components ) }; 579 579 } else { 580 580 // handle normally … … 672 672 } 673 673 std::vector< ast::ptr< ast::Expr > > vargs( args.begin(), args.end() ); 674 appExpr->args = move( vargs );674 appExpr->args = std::move( vargs ); 675 675 // build and validate new candidate 676 676 auto newCand = … … 783 783 if ( expl.exprs.empty() ) { 784 784 results.emplace_back( 785 results[i], move( env ), copy( results[i].need ),786 copy( results[i].have ), move( open ), nextArg + 1,785 results[i], std::move( env ), copy( results[i].need ), 786 copy( results[i].have ), std::move( open ), nextArg + 1, 787 787 expl.cost ); 788 788 … … 792 792 // add new result 793 793 results.emplace_back( 794 i, expl.exprs.front(), move( env ), copy( results[i].need ),795 copy( results[i].have ), move( open ), nextArg + 1, 0, expl.cost,794 i, expl.exprs.front(), std::move( env ), copy( results[i].need ), 795 copy( results[i].have ), std::move( open ), nextArg + 1, 0, expl.cost, 796 796 expl.exprs.size() == 1 ? 0 : 1, j ); 797 797 } … … 843 843 // as a member expression 844 844 addAnonConversions( newCand ); 845 candidates.emplace_back( move( newCand ) );845 candidates.emplace_back( std::move( newCand ) ); 846 846 } 847 847 } … … 901 901 const ast::EnumDecl * enumDecl = enumInst->base; 902 902 if ( const ast::Type* enumType = enumDecl->base ) { 903 // instance of enum (T) is a instance of type (T) 903 // instance of enum (T) is a instance of type (T) 904 904 funcFinder.otypeKeys.insert(Mangle::mangle(enumType, Mangle::NoGenericParams | Mangle::Type)); 905 905 } else { … … 907 907 funcFinder.otypeKeys.insert(Mangle::mangle(enumDecl, Mangle::NoGenericParams | Mangle::Type)); 908 908 } 909 } 909 } 910 910 else funcFinder.otypeKeys.insert(Mangle::mangle(argType, Mangle::NoGenericParams | Mangle::Type)); 911 911 } … … 986 986 funcE.emplace_back( *func, symtab ); 987 987 } 988 argExpansions.emplace_front( move( funcE ) );988 argExpansions.emplace_front( std::move( funcE ) ); 989 989 990 990 for ( const CandidateRef & op : opFinder ) { … … 1030 1030 if ( cvtCost != Cost::infinity ) { 1031 1031 withFunc->cvtCost = cvtCost; 1032 candidates.emplace_back( move( withFunc ) );1033 } 1034 } 1035 found = move( candidates );1032 candidates.emplace_back( std::move( withFunc ) ); 1033 } 1034 } 1035 found = std::move( candidates ); 1036 1036 1037 1037 // use a new list so that candidates are not examined by addAnonConversions twice … … 1131 1131 CandidateRef newCand = std::make_shared<Candidate>( 1132 1132 restructureCast( cand->expr, toType, castExpr->isGenerated ), 1133 copy( cand->env ), move( open ),move( need ), cand->cost,1133 copy( cand->env ), std::move( open ), std::move( need ), cand->cost, 1134 1134 cand->cost + thisCost ); 1135 1135 inferParameters( newCand, matches ); … … 1285 1285 // as a name expression 1286 1286 addAnonConversions( newCand ); 1287 candidates.emplace_back( move( newCand ) );1287 candidates.emplace_back( std::move( newCand ) ); 1288 1288 } 1289 1289 } … … 1394 1394 new ast::LogicalExpr{ 1395 1395 logicalExpr->location, r1->expr, r2->expr, logicalExpr->isAnd }, 1396 move( env ), move( open ),move( need ), r1->cost + r2->cost );1396 std::move( env ), std::move( open ), std::move( need ), r1->cost + r2->cost ); 1397 1397 } 1398 1398 } … … 1452 1452 // output candidate 1453 1453 CandidateRef newCand = std::make_shared<Candidate>( 1454 newExpr, move( env ), move( open ),move( need ), cost );1454 newExpr, std::move( env ), std::move( open ), std::move( need ), cost ); 1455 1455 inferParameters( newCand, candidates ); 1456 1456 } … … 1519 1519 // add candidate 1520 1520 CandidateRef newCand = std::make_shared<Candidate>( 1521 newExpr, move( env ), move( open ),move( need ),1521 newExpr, std::move( env ), std::move( open ), std::move( need ), 1522 1522 r1->cost + r2->cost ); 1523 1523 inferParameters( newCand, candidates ); … … 1548 1548 1549 1549 addCandidate( 1550 new ast::TupleExpr{ tupleExpr->location, move( exprs ) },1551 move( env ), move( open ),move( need ), sumCost( subs ) );1550 new ast::TupleExpr{ tupleExpr->location, std::move( exprs ) }, 1551 std::move( env ), std::move( open ), std::move( need ), sumCost( subs ) ); 1552 1552 } 1553 1553 } … … 1635 1635 initExpr->location, restructureCast( cand->expr, toType ), 1636 1636 initAlt.designation }, 1637 move(env), move( open ),move( need ), cand->cost, thisCost );1637 std::move(env), std::move( open ), std::move( need ), cand->cost, thisCost ); 1638 1638 inferParameters( newCand, matches ); 1639 1639 } … … 1768 1768 cand->env.applyFree( newResult ); 1769 1769 cand->expr = ast::mutate_field( 1770 cand->expr.get(), &ast::Expr::result, move( newResult ) );1770 cand->expr.get(), &ast::Expr::result, std::move( newResult ) ); 1771 1771 1772 1772 out.emplace_back( cand ); … … 1854 1854 1855 1855 auto oldsize = candidates.size(); 1856 candidates = move( pruned );1856 candidates = std::move( pruned ); 1857 1857 1858 1858 PRINT( -
src/main.cc
r9a90092 r09f34a84 325 325 ast::pass_visitor_stats.max = Stats::Counters::build<Stats::Counters::MaxCounter<double>>("Max depth - New"); 326 326 } 327 auto transUnit = convert( move( translationUnit ) );327 auto transUnit = convert( std::move( translationUnit ) ); 328 328 329 329 forceFillCodeLocations( transUnit ); … … 331 331 PASS( "Translate Exception Declarations", ControlStruct::translateExcept( transUnit ) ); 332 332 if ( exdeclp ) { 333 dump( move( transUnit ) );333 dump( std::move( transUnit ) ); 334 334 return EXIT_SUCCESS; 335 335 } … … 378 378 379 379 if ( validp ) { 380 dump( move( transUnit ) );380 dump( std::move( transUnit ) ); 381 381 return EXIT_SUCCESS; 382 382 } // if … … 399 399 400 400 if ( bresolvep ) { 401 dump( move( transUnit ) );401 dump( std::move( transUnit ) ); 402 402 return EXIT_SUCCESS; 403 403 } // if … … 410 410 PASS( "Resolve", ResolvExpr::resolve( transUnit ) ); 411 411 if ( exprp ) { 412 dump( move( transUnit ) );412 dump( std::move( transUnit ) ); 413 413 return EXIT_SUCCESS; 414 414 } // if … … 420 420 // fix ObjectDecl - replaces ConstructorInit nodes 421 421 if ( ctorinitp ) { 422 dump( move( transUnit ) );422 dump( std::move( transUnit ) ); 423 423 return EXIT_SUCCESS; 424 424 } // if … … 436 436 437 437 if ( tuplep ) { 438 dump( move( transUnit ) );438 dump( std::move( transUnit ) ); 439 439 return EXIT_SUCCESS; 440 440 } // if … … 445 445 PASS( "Instantiate Generics", GenPoly::instantiateGeneric( transUnit ) ); 446 446 447 translationUnit = convert( move( transUnit ) );447 translationUnit = convert( std::move( transUnit ) ); 448 448 449 449 if ( genericsp ) { … … 788 788 789 789 static void dump( ast::TranslationUnit && transUnit, ostream & out ) { 790 std::list< Declaration * > translationUnit = convert( move( transUnit ) );790 std::list< Declaration * > translationUnit = convert( std::move( transUnit ) ); 791 791 dump( translationUnit, out ); 792 792 }
Note:
See TracChangeset
for help on using the changeset viewer.