Skip to content

Commit 24f1357

Browse files
committed
Revert "[Analysis] -Wunreachable-code shouldn't fire on the increment of a foreach loop"
This reverts commit r354102. llvm-svn: 354109
1 parent 3c17cb7 commit 24f1357

File tree

2 files changed

+0
-9
lines changed

2 files changed

+0
-9
lines changed

clang/lib/Analysis/ReachableCode.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -631,10 +631,6 @@ void DeadCodeScan::reportDeadCode(const CFGBlock *B,
631631
// a for/for-range loop. This is the block that contains
632632
// the increment code.
633633
if (const Stmt *LoopTarget = B->getLoopTarget()) {
634-
// The increment on a foreach statement is not written.
635-
if (isa<CXXForRangeStmt>(LoopTarget))
636-
return;
637-
638634
SourceLocation Loc = LoopTarget->getBeginLoc();
639635
SourceRange R1(Loc, Loc), R2;
640636

clang/test/SemaCXX/unreachable-code.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ void test3() {
5252
}
5353
}
5454

55-
void test4() {
56-
for (char c : "abc") // no-warning
57-
break;
58-
}
59-
6055
// PR 6130 - Don't warn about bogus unreachable code with throw's and
6156
// temporary objects.
6257
class PR6130 {

0 commit comments

Comments
 (0)