JonasToth added a comment.

> But in our codebase, we have code intended to use like below, and it is in 
> base library, and is used widely. I think it makes sense to whitelist this 
> class in our internal configuration.
> 
>   for (auto _ : state) {
>      ... // no `_` being referenced in the for-loop body
>   }

I see.



================
Comment at: clang-tidy/performance/ForRangeCopyCheck.cpp:93
     return false;
   if (utils::ExprMutationAnalyzer(ForRange.getBody(), &Context)
           .isMutated(&LoopVar))
----------------
Adding a `..IsMutated(&LoopVar) && IsReferenced(ForScope, LoopVar))` here 
should fix the warning as well.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D50447



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to