r332135 - [analyzer] Fix the filename for the exploration_order test.

George Karpenkov via cfe-commits cfe-commits at lists.llvm.org
Fri May 11 13:38:39 PDT 2018


Author: george.karpenkov
Date: Fri May 11 13:38:39 2018
New Revision: 332135

URL: http://llvm.org/viewvc/llvm-project?rev=332135&view=rev
Log:
[analyzer] Fix the filename for the exploration_order test.

Ensures that the test is being run.

Added:
    cfe/trunk/test/Analysis/exploration_order/prefer_unexplored.cpp
      - copied, changed from r331483, cfe/trunk/test/Analysis/exploration_order/prefer_unexplored.cc
Removed:
    cfe/trunk/test/Analysis/exploration_order/prefer_unexplored.cc

Removed: cfe/trunk/test/Analysis/exploration_order/prefer_unexplored.cc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/exploration_order/prefer_unexplored.cc?rev=332134&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/exploration_order/prefer_unexplored.cc (original)
+++ cfe/trunk/test/Analysis/exploration_order/prefer_unexplored.cc (removed)
@@ -1,40 +0,0 @@
-// RUN: %clang_analyze_cc1 -w -analyzer-checker=core -analyzer-config exploration_strategy=unexplored_first -analyzer-output=text -verify %s | FileCheck %s
-// RUN: %clang_analyze_cc1 -w -analyzer-checker=core -analyzer-config exploration_strategy=unexplored_first_queue -analyzer-output=text -verify %s | FileCheck %s
-
-extern int coin();
-
-int foo() {
-    int *x = 0; // expected-note {{'x' initialized to a null pointer value}}
-    while (coin()) { // expected-note{{Loop condition is true}}
-        if (coin())  // expected-note {{Taking true branch}}
-            return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}
-                       // expected-note at -1{{Dereference of null pointer (loaded from variable 'x')}}
-    }
-    return 0;
-}
-
-void bar() {
-    while(coin()) // expected-note{{Loop condition is true}}
-        if (coin()) // expected-note {{Assuming the condition is true}}
-            foo(); // expected-note{{Calling 'foo'}}
-}
-
-int foo2() {
-    int *x = 0; // expected-note {{'x' initialized to a null pointer value}}
-    while (coin()) { // expected-note{{Loop condition is true}}
-        if (coin())  // expected-note {{Taking false branch}}
-            return false;
-        else
-            return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}
-                       // expected-note at -1{{Dereference of null pointer (loaded from variable 'x')}}
-    }
-    return 0;
-}
-
-void bar2() {
-    while(coin()) // expected-note{{Loop condition is true}}
-        if (coin()) // expected-note {{Assuming the condition is false}}
-          return false;
-        else
-            foo(); // expected-note{{Calling 'foo'}}
-}

Copied: cfe/trunk/test/Analysis/exploration_order/prefer_unexplored.cpp (from r331483, cfe/trunk/test/Analysis/exploration_order/prefer_unexplored.cc)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/exploration_order/prefer_unexplored.cpp?p2=cfe/trunk/test/Analysis/exploration_order/prefer_unexplored.cpp&p1=cfe/trunk/test/Analysis/exploration_order/prefer_unexplored.cc&r1=331483&r2=332135&rev=332135&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/exploration_order/prefer_unexplored.cc (original)
+++ cfe/trunk/test/Analysis/exploration_order/prefer_unexplored.cpp Fri May 11 13:38:39 2018
@@ -1,5 +1,5 @@
-// RUN: %clang_analyze_cc1 -w -analyzer-checker=core -analyzer-config exploration_strategy=unexplored_first -analyzer-output=text -verify %s | FileCheck %s
-// RUN: %clang_analyze_cc1 -w -analyzer-checker=core -analyzer-config exploration_strategy=unexplored_first_queue -analyzer-output=text -verify %s | FileCheck %s
+// RUN: %clang_analyze_cc1 -w -analyzer-checker=core -analyzer-config exploration_strategy=unexplored_first -analyzer-output=text -verify %s
+// RUN: %clang_analyze_cc1 -w -analyzer-checker=core -analyzer-config exploration_strategy=unexplored_first_queue -analyzer-output=text -verify %s
 
 extern int coin();
 
@@ -7,6 +7,7 @@ int foo() {
     int *x = 0; // expected-note {{'x' initialized to a null pointer value}}
     while (coin()) { // expected-note{{Loop condition is true}}
         if (coin())  // expected-note {{Taking true branch}}
+                     // expected-note at -1 {{Assuming the condition is true}}
             return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}
                        // expected-note at -1{{Dereference of null pointer (loaded from variable 'x')}}
     }
@@ -14,15 +15,16 @@ int foo() {
 }
 
 void bar() {
-    while(coin()) // expected-note{{Loop condition is true}}
-        if (coin()) // expected-note {{Assuming the condition is true}}
-            foo(); // expected-note{{Calling 'foo'}}
+    while(coin())
+        if (coin())
+            foo();
 }
 
 int foo2() {
     int *x = 0; // expected-note {{'x' initialized to a null pointer value}}
     while (coin()) { // expected-note{{Loop condition is true}}
         if (coin())  // expected-note {{Taking false branch}}
+                     // expected-note at -1 {{Assuming the condition is false}}
             return false;
         else
             return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}
@@ -34,7 +36,8 @@ int foo2() {
 void bar2() {
     while(coin()) // expected-note{{Loop condition is true}}
         if (coin()) // expected-note {{Assuming the condition is false}}
-          return false;
+                    // expected-note at -1 {{Taking false branch}}
+          return;
         else
             foo(); // expected-note{{Calling 'foo'}}
 }




More information about the cfe-commits mailing list