]> granicus.if.org Git - clang/commitdiff
As of r202325, CFGBlock predecessors may be NULL. Ignore such preds. Fixes a crasher...
authorNick Lewycky <nicholas@mxc.ca>
Thu, 27 Feb 2014 02:43:25 +0000 (02:43 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Thu, 27 Feb 2014 02:43:25 +0000 (02:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202340 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/AnalysisBasedWarnings.cpp
test/SemaCXX/switch-implicit-fallthrough.cpp

index 099ef253736c878f93afd4854d70c3d59b63a07a..e6f2f82dd271b974f6d09739ff2ca1a917f6adc6 100644 (file)
@@ -887,6 +887,7 @@ namespace {
       while (!BlockQueue.empty()) {
         const CFGBlock *P = BlockQueue.front();
         BlockQueue.pop_front();
+        if (!P) continue;
 
         const Stmt *Term = P->getTerminator();
         if (Term && isa<SwitchStmt>(Term))
index d7959238c6b3612919432746df03295047767bd5..831324a64e9edeb32921a41a012f53cb5a947eb2 100644 (file)
@@ -265,3 +265,16 @@ void fallthrough_in_local_class() {
   };
 }
 
+namespace PR18983 {
+  void fatal() __attribute__((noreturn));
+  int num();
+  void test() {
+    switch (num()) {
+    case 1:
+      fatal();
+      // Don't issue a warning.
+    case 2:
+      break;
+    }
+  }
+}