When reporting branch conditions that evaluate to an uninitialized value,
highlight the most nested subexpression that appears most responsible (giving
the user better diagnostic feedback).
Updated test cases to illustrate this feature.
Implements: <rdar://problem/5880443>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50647 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/uninit-vals-ps.c b/test/Analysis/uninit-vals-ps.c
index 36db470..503ab1a 100644
--- a/test/Analysis/uninit-vals-ps.c
+++ b/test/Analysis/uninit-vals-ps.c
@@ -16,3 +16,20 @@
int x;
return bar(x)+1; // expected-warning{{Pass-by-value argument in function is undefined.}}
}
+
+int f2() {
+
+ int x;
+
+ if (x+1) // expected-warning{{Branch}}
+ return 1;
+
+ return 2;
+}
+
+int f2_b() {
+ int x;
+
+ return ((x+1)+2+((x))) + 1 ? 1 : 2; // expected-warning{{Branch}}
+}
+