forked from OSchip/llvm-project
[analyzer] Add a test case for diagnostic suppression on a graph with cycles.
(see previous commit) llvm-svn: 177449
This commit is contained in:
parent
431e4e4d0e
commit
15a185f1e0
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue