]> granicus.if.org Git - clang/commit
[-Wunreachable-code] always treat 'case:' and 'default:' cases as reachable.
authorTed Kremenek <kremenek@apple.com>
Thu, 27 Feb 2014 21:56:47 +0000 (21:56 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 27 Feb 2014 21:56:47 +0000 (21:56 +0000)
commitb228a86eb77a50de294c614a8b2724773cdd4389
tree611bd0a45cd0c9493e0ed9559ac41fa7a4661bbb
parentaf663ae39c1c5da37303f6f1d956908e12d18716
[-Wunreachable-code] always treat 'case:' and 'default:' cases as reachable.

This is a heuristic.  Many switch statements, although they look covered
over an enum, may actually handle at runtime more values than in the enum.

This is overly conservative, as there are some cases that clearly
can be ruled as being clearly unreachable, e.g. 'switch (42) { case 1: ... }'.
We can refine this later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202436 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ReachableCode.cpp
test/Sema/warn-unreachable.c