Changeset 09f34a84 for src


Ignore:
Timestamp:
Sep 16, 2022, 11:19:04 AM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
4407b7e
Parents:
9a90092
Message:

Remove some of the warnings on the new clang

Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Print.cpp

    r9a90092 r09f34a84  
    3333{
    3434        return array<C,sizeof...(T)>{
    35                 forward<T>(values)...
     35                std::forward<T>(values)...
    3636        };
    3737}
  • src/AST/Type.cpp

    r9a90092 r09f34a84  
    143143TraitInstType::TraitInstType(
    144144        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 ) {}
    146146
    147147// --- TypeInstType
     
    149149TypeInstType::TypeInstType( const TypeDecl * b,
    150150        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 ) {}
    152152
    153153void TypeInstType::set_base( const TypeDecl * b ) {
     
    161161
    162162TupleType::TupleType( std::vector<ptr<Type>> && ts, CV::Qualifiers q )
    163 : Type( q ), types( move(ts) ), members() {
     163: Type( q ), types( std::move(ts) ), members() {
    164164        // This constructor is awkward. `TupleType` needs to contain objects so that members can be
    165165        // named, but members without initializer nodes end up getting constructors, which breaks
  • src/Concurrency/Keywords.cc

    r9a90092 r09f34a84  
    508508                ObjectDecl * vtable_object = Virtual::makeVtableForward(
    509509                        "_default_vtable_object_declaration",
    510                         vtable_decl->makeInst( move( poly_args ) ) );
     510                        vtable_decl->makeInst( std::move( poly_args ) ) );
    511511                declsToAddBefore.push_back( vtable_object );
    512512                declsToAddBefore.push_back(
     
    681681                        void lock (monitor_t & this) {
    682682                                lock(get_monitor(this));
    683                         }       
     683                        }
    684684                */
    685685                FunctionDecl * lock_decl = new FunctionDecl(
     
    700700                CompoundStmt * lock_statement = new CompoundStmt();
    701701                lock_statement->push_back(
    702                         new ExprStmt( 
     702                        new ExprStmt(
    703703                                new UntypedExpr (
    704704                                        new NameExpr( "lock" ),
     
    716716                        void unlock (monitor_t & this) {
    717717                                unlock(get_monitor(this));
    718                         }       
     718                        }
    719719                */
    720720                FunctionDecl * unlock_decl = new FunctionDecl(
     
    736736
    737737                unlock_statement->push_back(
    738                         new ExprStmt( 
     738                        new ExprStmt(
    739739                                new UntypedExpr(
    740740                                        new NameExpr( "unlock" ),
     
    746746                );
    747747                unlock_decl->set_statements( unlock_statement );
    748                
     748
    749749                // pushes routines to declsToAddAfter to add at a later time
    750750                declsToAddAfter.push_back( lock_decl );
     
    10541054                        assert( !thread_guard_decl );
    10551055                        thread_guard_decl = decl;
    1056                 } 
     1056                }
    10571057                else if ( decl->name == "__mutex_stmt_lock_guard" && decl->body ) {
    10581058                        assert( !lock_guard_decl );
     
    12061206                                                        new NameExpr( "__get_mutexstmt_lock_type" ),
    12071207                                                        { args.front()->clone() }
    1208                                                 ) 
     1208                                                )
    12091209                                        )
    12101210                                ),
     
    12251225
    12261226                StructInstType * lock_guard_struct = new StructInstType( noQualifiers, lock_guard_decl );
    1227                 TypeExpr * lock_type_expr = new TypeExpr( 
     1227                TypeExpr * lock_type_expr = new TypeExpr(
    12281228                        new TypeofType( noQualifiers, new UntypedExpr(
    12291229                                new NameExpr( "__get_mutexstmt_lock_type" ),
    12301230                                { args.front()->clone() }
    1231                                 ) 
    1232                         ) 
     1231                                )
     1232                        )
    12331233                );
    12341234
  • src/Parser/parser.yy

    r9a90092 r09f34a84  
    5858
    5959// 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"
    6163
    6264extern DeclarationNode * parseTree;
  • src/ResolvExpr/CandidateFinder.cpp

    r9a90092 r09f34a84  
    269269                        unsigned nextArg, unsigned tupleStart = 0, Cost cost = Cost::zero,
    270270                        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 ),
    273273                  nextExpl( nextExpl ), explAlt( explAlt ) {}
    274274
     
    276276                        const ArgPack & o, ast::TypeEnvironment && env, ast::AssertionSet && need,
    277277                        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 ),
    280280                  tupleStart( o.tupleStart ), nextExpl( 0 ), explAlt( 0 ) {}
    281281
     
    301301                        // reset pack to appropriate tuple
    302302                        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 ) };
    304304                        tupleStart = pack->tupleStart - 1;
    305305                        parent = pack->parent;
     
    404404                                                                newResult.open, symtab )
    405405                                                ) {
    406                                                         finalResults.emplace_back( move( newResult ) );
     406                                                        finalResults.emplace_back( std::move( newResult ) );
    407407                                                }
    408408
     
    423423                                                if ( expl.exprs.empty() ) {
    424424                                                        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 );
    427427
    428428                                                        continue;
     
    431431                                                // add new result
    432432                                                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,
    435435                                                        expl.cost, expl.exprs.size() == 1 ? 0 : 1, j );
    436436                                        }
     
    444444                        // splice final results onto results
    445445                        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] ) );
    447447                        }
    448448                        return ! finalResults.empty();
     
    478478
    479479                                        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,
    481481                                                nTuples, Cost::zero, nextExpl, results[i].explAlt );
    482482                                }
     
    494494                                        if ( unify( paramType, cnst->result, env, need, have, open, symtab ) ) {
    495495                                                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 );
    498498                                        }
    499499                                }
     
    516516                                if ( expl.exprs.empty() ) {
    517517                                        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 ),
    519519                                                nextArg + 1, expl.cost );
    520520
     
    538538                                        // add new result
    539539                                        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 ),
    541541                                                nextArg + 1, nTuples, expl.cost, expl.exprs.size() == 1 ? 0 : 1, j );
    542542                                }
     
    576576                                        restructureCast( idx, toType->getComponent( i ), isGenerated ) );
    577577                        }
    578                         return new ast::TupleExpr{ arg->location, move( components ) };
     578                        return new ast::TupleExpr{ arg->location, std::move( components ) };
    579579                } else {
    580580                        // handle normally
     
    672672                        }
    673673                        std::vector< ast::ptr< ast::Expr > > vargs( args.begin(), args.end() );
    674                         appExpr->args = move( vargs );
     674                        appExpr->args = std::move( vargs );
    675675                        // build and validate new candidate
    676676                        auto newCand =
     
    783783                                                        if ( expl.exprs.empty() ) {
    784784                                                                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,
    787787                                                                        expl.cost );
    788788
     
    792792                                                        // add new result
    793793                                                        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,
    796796                                                                expl.exprs.size() == 1 ? 0 : 1, j );
    797797                                                }
     
    843843                                // as a member expression
    844844                                addAnonConversions( newCand );
    845                                 candidates.emplace_back( move( newCand ) );
     845                                candidates.emplace_back( std::move( newCand ) );
    846846                        }
    847847                }
     
    901901                                                        const ast::EnumDecl * enumDecl = enumInst->base;
    902902                                                        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)
    904904                                                                funcFinder.otypeKeys.insert(Mangle::mangle(enumType, Mangle::NoGenericParams | Mangle::Type));
    905905                                                        } else {
     
    907907                                                                funcFinder.otypeKeys.insert(Mangle::mangle(enumDecl, Mangle::NoGenericParams | Mangle::Type));
    908908                                                        }
    909                                                 } 
     909                                                }
    910910                                                else funcFinder.otypeKeys.insert(Mangle::mangle(argType, Mangle::NoGenericParams | Mangle::Type));
    911911                                        }
     
    986986                                        funcE.emplace_back( *func, symtab );
    987987                                }
    988                                 argExpansions.emplace_front( move( funcE ) );
     988                                argExpansions.emplace_front( std::move( funcE ) );
    989989
    990990                                for ( const CandidateRef & op : opFinder ) {
     
    10301030                                if ( cvtCost != Cost::infinity ) {
    10311031                                        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 );
    10361036
    10371037                        // use a new list so that candidates are not examined by addAnonConversions twice
     
    11311131                                        CandidateRef newCand = std::make_shared<Candidate>(
    11321132                                                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,
    11341134                                                cand->cost + thisCost );
    11351135                                        inferParameters( newCand, matches );
     
    12851285                                // as a name expression
    12861286                                addAnonConversions( newCand );
    1287                                 candidates.emplace_back( move( newCand ) );
     1287                                candidates.emplace_back( std::move( newCand ) );
    12881288                        }
    12891289                }
     
    13941394                                                new ast::LogicalExpr{
    13951395                                                        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 );
    13971397                                }
    13981398                        }
     
    14521452                                                        // output candidate
    14531453                                                        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 );
    14551455                                                        inferParameters( newCand, candidates );
    14561456                                                }
     
    15191519                                                // add candidate
    15201520                                                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 ),
    15221522                                                        r1->cost + r2->cost );
    15231523                                                inferParameters( newCand, candidates );
     
    15481548
    15491549                                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 ) );
    15521552                        }
    15531553                }
     
    16351635                                                                initExpr->location, restructureCast( cand->expr, toType ),
    16361636                                                                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 );
    16381638                                                inferParameters( newCand, matches );
    16391639                                        }
     
    17681768                cand->env.applyFree( newResult );
    17691769                cand->expr = ast::mutate_field(
    1770                         cand->expr.get(), &ast::Expr::result, move( newResult ) );
     1770                        cand->expr.get(), &ast::Expr::result, std::move( newResult ) );
    17711771
    17721772                out.emplace_back( cand );
     
    18541854
    18551855                auto oldsize = candidates.size();
    1856                 candidates = move( pruned );
     1856                candidates = std::move( pruned );
    18571857
    18581858                PRINT(
  • src/main.cc

    r9a90092 r09f34a84  
    325325                        ast::pass_visitor_stats.max = Stats::Counters::build<Stats::Counters::MaxCounter<double>>("Max depth - New");
    326326                }
    327                 auto transUnit = convert( move( translationUnit ) );
     327                auto transUnit = convert( std::move( translationUnit ) );
    328328
    329329                forceFillCodeLocations( transUnit );
     
    331331                PASS( "Translate Exception Declarations", ControlStruct::translateExcept( transUnit ) );
    332332                if ( exdeclp ) {
    333                         dump( move( transUnit ) );
     333                        dump( std::move( transUnit ) );
    334334                        return EXIT_SUCCESS;
    335335                }
     
    378378
    379379                if ( validp ) {
    380                         dump( move( transUnit ) );
     380                        dump( std::move( transUnit ) );
    381381                        return EXIT_SUCCESS;
    382382                } // if
     
    399399
    400400                if ( bresolvep ) {
    401                         dump( move( transUnit ) );
     401                        dump( std::move( transUnit ) );
    402402                        return EXIT_SUCCESS;
    403403                } // if
     
    410410                PASS( "Resolve", ResolvExpr::resolve( transUnit ) );
    411411                if ( exprp ) {
    412                         dump( move( transUnit ) );
     412                        dump( std::move( transUnit ) );
    413413                        return EXIT_SUCCESS;
    414414                } // if
     
    420420                // fix ObjectDecl - replaces ConstructorInit nodes
    421421                if ( ctorinitp ) {
    422                         dump( move( transUnit ) );
     422                        dump( std::move( transUnit ) );
    423423                        return EXIT_SUCCESS;
    424424                } // if
     
    436436
    437437                if ( tuplep ) {
    438                         dump( move( transUnit ) );
     438                        dump( std::move( transUnit ) );
    439439                        return EXIT_SUCCESS;
    440440                } // if
     
    445445                PASS( "Instantiate Generics", GenPoly::instantiateGeneric( transUnit ) );
    446446
    447                 translationUnit = convert( move( transUnit ) );
     447                translationUnit = convert( std::move( transUnit ) );
    448448
    449449                if ( genericsp ) {
     
    788788
    789789static void dump( ast::TranslationUnit && transUnit, ostream & out ) {
    790         std::list< Declaration * > translationUnit = convert( move( transUnit ) );
     790        std::list< Declaration * > translationUnit = convert( std::move( transUnit ) );
    791791        dump( translationUnit, out );
    792792}
Note: See TracChangeset for help on using the changeset viewer.