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:                 [email protected]

www.evidente.se
Index: lib/Sema/SemaOverload.cpp
===================================================================
--- lib/Sema/SemaOverload.cpp	(revision 191370)
+++ lib/Sema/SemaOverload.cpp	(arbetskopia)
@@ -11392,7 +11392,6 @@
     Method->getType()->getAs<FunctionProtoType>();

   unsigned NumArgsInProto = Proto->getNumArgs();
-  unsigned NumArgsToCheck = std::max<unsigned>(Args.size(), NumArgsInProto);

   DeclarationNameInfo OpLocInfo(
                Context.DeclarationNames.getCXXOperatorName(OO_Call), LParenLoc);
@@ -11430,8 +11429,6 @@
   // slots in the call for them.
   if (Args.size() < NumArgsInProto)
     TheCall->setNumArgs(Context, NumArgsInProto + 1);
-  else if (Args.size() > NumArgsInProto)
-    NumArgsToCheck = NumArgsInProto;

   bool IsError = false;

@@ -11446,7 +11443,7 @@
   TheCall->setArg(0, Object.take());

   // Check the argument types.
-  for (unsigned i = 0; i != NumArgsToCheck; i++) {
+  for (unsigned i = 0; i != NumArgsInProto; i++) {
     Expr *Arg;
     if (i < Args.size()) {
       Arg = Args[i];
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to