Your points are valid. I just tried to guess the "intent" of the code, leaving 
HadToDeduceReturnTypeDuringCurrentCall as in a comment below, and assuming that 
the assert was there just for the construction of FromTypePtr (guessed from its 
placement).

I suggest that the original committer of r191634, Faisal Vali, make further 
reverts/cleanups.

Regards,
Patrik Hägglund

From: David Blaikie [mailto:[email protected]]
Sent: den 2 oktober 2013 18:59
To: Patrik Hägglund H
Cc: llvm cfe
Subject: Re: r191817 - Fix gcc -Wunused-but-set-variable warning in r191634.


On Oct 2, 2013 4:06 AM, "Patrik Hagglund" 
<[email protected]<mailto:[email protected]>> wrote:
>
> Author: patha
> Date: Wed Oct  2 05:59:08 2013
> New Revision: 191817
>
> URL: http://llvm.org/viewvc/llvm-project?rev=191817&view=rev
> Log:
> Fix gcc -Wunused-but-set-variable warning in r191634.
>
> Modified:
>     cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=191817&r1=191816&r2=191817&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Wed Oct  2 05:59:08 2013
> @@ -3745,11 +3745,8 @@ Sema::DeduceTemplateArguments(FunctionTe
>    const bool IsGenericLambdaConversionOperator =
>        isLambdaConversionOperator(Conv);
>    if (IsGenericLambdaConversionOperator) {
> -    const Type *FromTypePtr = P.getTypePtr();
>      const Type *ToTypePtr = A.getTypePtr();
>
> -    assert(P->isPointerType());

You lost this assert in your change (presumably the warning was firing in a 
release build). Unless you have some reason not to want this assert anymore, 
please leave it in.

> -    FromTypePtr = P->getPointeeType().getTypePtr();
>      assert(A->isPointerType());
>      ToTypePtr = A->getPointeeType().getTypePtr();
>
> @@ -3781,11 +3778,11 @@ Sema::DeduceTemplateArguments(FunctionTe
>                                                      0, CallOpSpec, OpInfo))
>        return Result;
>
> -    bool HadToDeduceReturnTypeDuringCurrentCall = false;
> +    // bool HadToDeduceReturnTypeDuringCurrentCall = false;

Please delete these lines rather than leaving them commented out.

>      // If we need to deduce the return type, do so (instantiates the callop).
>      if (GenericLambdaCallOperatorHasDeducedReturnType &&
>          CallOpSpec->getResultType()->isUndeducedType()) {
> -      HadToDeduceReturnTypeDuringCurrentCall = true;
> +      // HadToDeduceReturnTypeDuringCurrentCall = true;
>        DeduceReturnType(CallOpSpec, CallOpSpec->getPointOfInstantiation(),
>                        /*Diagnose*/ true);
>      }
>
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]<mailto:[email protected]>
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to