r202340 - As of r202325,	CFGBlock predecessors may be NULL. Ignore such preds. Fixes a crasher, 	PR18983.
    Nick Lewycky 
    nicholas at mxc.ca
       
    Wed Feb 26 18:43:25 PST 2014
    
    
  
Author: nicholas
Date: Wed Feb 26 20:43:25 2014
New Revision: 202340
URL: http://llvm.org/viewvc/llvm-project?rev=202340&view=rev
Log:
As of r202325, CFGBlock predecessors may be NULL. Ignore such preds. Fixes a crasher, PR18983.
Modified:
    cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
    cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp
Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=202340&r1=202339&r2=202340&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original)
+++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Wed Feb 26 20:43:25 2014
@@ -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))
Modified: cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp?rev=202340&r1=202339&r2=202340&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp (original)
+++ cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp Wed Feb 26 20:43:25 2014
@@ -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;
+    }
+  }
+}
    
    
More information about the cfe-commits
mailing list