[PATCH] cleanup redundant variable NumArgsToCheck

Daniel Marjamäki Daniel.Marjamaki at evidente.se
Fri Sep 27 22:04:53 PDT 2013


I would like to have this little cleanup reviewed.

I saw this redundant variable when looking at r191370 where NumArgsToCheck was simplified.

In short the old code is:

    unsigned NumArgsToCheck = std::max<unsigned>(Args.size(), NumArgsInProto);
    ...
    if (Args.size() > NumArgsInProto)
        NumArgsToCheck = NumArgsInProto;
    ...
    for (unsigned i = 0; i != NumArgsToCheck; i++) {  // <- Only place where NumArgsToCheck is used

The Args is not changed anywhere as far as I see. And neither is NumArgsInProto.

Therefore when NumArgsToCheck is used in the for-loop it will always be equal with NumArgsInProto, as far as I see.

All tests pass.

..................................................................................................................
Daniel Marjamäki Senior Engineer
Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden

Mobile:                 +46 (0)709 12 42 62
E-mail:                 Daniel.Marjamaki at evidente.se

www.evidente.se
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove-NumArgsToCheck.diff
Type: text/x-patch
Size: 1037 bytes
Desc: remove-NumArgsToCheck.diff
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130928/6d514453/attachment.bin>


More information about the cfe-commits mailing list