]> granicus.if.org Git - clang/commitdiff
Test case for transfer function logic of const casts.
authorTed Kremenek <kremenek@apple.com>
Fri, 19 Sep 2008 20:53:52 +0000 (20:53 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 19 Sep 2008 20:53:52 +0000 (20:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56369 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/uninit-vals.m [new file with mode: 0644]

diff --git a/test/Analysis/uninit-vals.m b/test/Analysis/uninit-vals.m
new file mode 100644 (file)
index 0000000..74aa667
--- /dev/null
@@ -0,0 +1,24 @@
+// RUN: clang -checker-cfref -verify %s
+
+typedef unsigned int NSUInteger;
+
+@interface A
+- (NSUInteger)foo;
+@end
+
+NSUInteger f8(A* x){
+  const NSUInteger n = [x foo];
+  int* bogus;  
+
+  if (n > 0) {    // tests const cast transfer function logic
+    NSUInteger i;
+    
+    for (i = 0; i < n; ++i)
+      bogus = 0;
+
+    if (bogus)  // no-warning
+      return n+1;
+  }
+  
+  return n;
+}