[cfe-commits] r56369 - /cfe/trunk/test/Analysis/uninit-vals.m

Ted Kremenek kremenek at apple.com
Fri Sep 19 13:53:53 PDT 2008


Author: kremenek
Date: Fri Sep 19 15:53:52 2008
New Revision: 56369

URL: http://llvm.org/viewvc/llvm-project?rev=56369&view=rev
Log:
Test case for transfer function logic of const casts.

Added:
    cfe/trunk/test/Analysis/uninit-vals.m

Added: cfe/trunk/test/Analysis/uninit-vals.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/uninit-vals.m?rev=56369&view=auto

==============================================================================
--- cfe/trunk/test/Analysis/uninit-vals.m (added)
+++ cfe/trunk/test/Analysis/uninit-vals.m Fri Sep 19 15:53:52 2008
@@ -0,0 +1,24 @@
+// RUN: clang -checker-cfref -verify %s
+
+typedef unsigned int NSUInteger;
+
+ at interface A
+- (NSUInteger)foo;
+ at 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;
+}





More information about the cfe-commits mailing list