r354109 - Revert "[Analysis] -Wunreachable-code shouldn't fire on the increment of a foreach loop"

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 15 06:16:36 PST 2019


When reverting something, can you say why you're reverting in the commit
message please?

On Fri, Feb 15, 2019 at 4:18 AM Sam McCall via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: sammccall
> Date: Fri Feb 15 01:18:49 2019
> New Revision: 354109
>
> URL: http://llvm.org/viewvc/llvm-project?rev=354109&view=rev
> Log:
> Revert "[Analysis] -Wunreachable-code shouldn't fire on the increment of a
> foreach loop"
>
> This reverts commit r354102.
>
> Modified:
>     cfe/trunk/lib/Analysis/ReachableCode.cpp
>     cfe/trunk/test/SemaCXX/unreachable-code.cpp
>
> Modified: cfe/trunk/lib/Analysis/ReachableCode.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ReachableCode.cpp?rev=354109&r1=354108&r2=354109&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Analysis/ReachableCode.cpp (original)
> +++ cfe/trunk/lib/Analysis/ReachableCode.cpp Fri Feb 15 01:18:49 2019
> @@ -631,10 +631,6 @@ void DeadCodeScan::reportDeadCode(const
>      // a for/for-range loop.  This is the block that contains
>      // the increment code.
>      if (const Stmt *LoopTarget = B->getLoopTarget()) {
> -      // The increment on a foreach statement is not written.
> -      if (isa<CXXForRangeStmt>(LoopTarget))
> -        return;
> -
>        SourceLocation Loc = LoopTarget->getBeginLoc();
>        SourceRange R1(Loc, Loc), R2;
>
>
> Modified: cfe/trunk/test/SemaCXX/unreachable-code.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/unreachable-code.cpp?rev=354109&r1=354108&r2=354109&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/SemaCXX/unreachable-code.cpp (original)
> +++ cfe/trunk/test/SemaCXX/unreachable-code.cpp Fri Feb 15 01:18:49 2019
> @@ -52,11 +52,6 @@ void test3() {
>    }
>  }
>
> -void test4() {
> -  for (char c : "abc") // no-warning
> -    break;
> -}
> -
>  // PR 6130 - Don't warn about bogus unreachable code with throw's and
>  // temporary objects.
>  class PR6130 {
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190215/0d1d1dbe/attachment.html>


More information about the cfe-commits mailing list