r283096 - [StaticAnalyser] Add test case to ensure that unreachable code is found.

Daniel Marjamaki via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 02:45:36 PDT 2016


Author: danielmarjamaki
Date: Mon Oct  3 04:45:35 2016
New Revision: 283096

URL: http://llvm.org/viewvc/llvm-project?rev=283096&view=rev
Log:
[StaticAnalyser] Add test case to ensure that unreachable code is found.

https://reviews.llvm.org/D24905


Modified:
    cfe/trunk/test/Analysis/unreachable-code-path.c

Modified: cfe/trunk/test/Analysis/unreachable-code-path.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/unreachable-code-path.c?rev=283096&r1=283095&r2=283096&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/unreachable-code-path.c (original)
+++ cfe/trunk/test/Analysis/unreachable-code-path.c Mon Oct  3 04:45:35 2016
@@ -161,12 +161,23 @@ void testInlined() {
 
 // Don't warn about unreachable VarDecl.
 void dostuff(int*A);
-void varDecl(int X) {
+void varDecl1(int X) {
   switch (X) {
     int A; // No warning here.
   case 1:
     dostuff(&A);
     break;
+  case 2:
+    dostuff(&A);
+    break;
+  }
+}
+void varDecl2(int X) {
+  switch (X) {
+    int A=1; // expected-warning {{never executed}}
+  case 1:
+    dostuff(&A);
+    break;
   case 2:
     dostuff(&A);
     break;




More information about the cfe-commits mailing list