r177449 - [analyzer] Add a test case for diagnostic suppression on a graph with cycles.

Jordan Rose jordan_rose at apple.com
Tue Mar 19 15:10:44 PDT 2013


Author: jrose
Date: Tue Mar 19 17:10:44 2013
New Revision: 177449

URL: http://llvm.org/viewvc/llvm-project?rev=177449&view=rev
Log:
[analyzer] Add a test case for diagnostic suppression on a graph with cycles.

(see previous commit)

Added:
    cfe/trunk/test/Analysis/diagnostics/shortest-path-suppression.c

Added: cfe/trunk/test/Analysis/diagnostics/shortest-path-suppression.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/shortest-path-suppression.c?rev=177449&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/diagnostics/shortest-path-suppression.c (added)
+++ cfe/trunk/test/Analysis/diagnostics/shortest-path-suppression.c Tue Mar 19 17:10:44 2013
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-config suppress-null-return-paths=true -analyzer-output=text -verify %s
+// expected-no-diagnostics
+
+int *returnNull() { return 0; }
+int coin();
+
+// Use a float parameter to ensure that the value is unknown. This will create
+// a cycle in the generated ExplodedGraph.
+void testCycle(float i) {
+  int *x = returnNull();
+  int y; 
+  while (i > 0) {
+    x = returnNull();
+    y = 2;
+    i -= 1;
+  }
+  *x = 1; // no-warning
+  y += 1;
+}





More information about the cfe-commits mailing list