]> granicus.if.org Git - clang/commit
Don't warn on fall-through from unreachable code.
authorAlexander Kornienko <alexfh@google.com>
Wed, 30 Jan 2013 03:49:44 +0000 (03:49 +0000)
committerAlexander Kornienko <alexfh@google.com>
Wed, 30 Jan 2013 03:49:44 +0000 (03:49 +0000)
commit4874a8143dc3032205f97527ff619730db3d1f57
treefd6f43451e458f74a7ff35f7756820bca0651a84
parente28f6abf588f51a21d1db638e460f9c086c08db4
Don't warn on fall-through from unreachable code.

Summary:
A motivating example:
class ClassWithDtor {
public:
  ~ClassWithDtor() {}
};
void fallthrough3(int n) {
  switch (n) {
    case 2:
      do {
        ClassWithDtor temp;
        return;
      } while (0);  // This generates a chain of unreachable CFG blocks.
    case 3:
      break;
  }
}

Reviewers: rsmith, doug.gregor, alexfh

Reviewed By: alexfh

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D330

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173889 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/AnalysisBasedWarnings.cpp
test/SemaCXX/switch-implicit-fallthrough.cpp