From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/Analysis/uninit-vals.m | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 clang/test/Analysis/uninit-vals.m (limited to 'clang/test/Analysis/uninit-vals.m') diff --git a/clang/test/Analysis/uninit-vals.m b/clang/test/Analysis/uninit-vals.m new file mode 100644 index 0000000..4ba26f5 --- /dev/null +++ b/clang/test/Analysis/uninit-vals.m @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -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; +} + + +// PR10163 -- don't warn for default-initialized float arrays. +// (An additional test is in uninit-vals-ps-region.m) +void test_PR10163(float); +void PR10163 (void) { + float x[2] = {0}; + test_PR10163(x[1]); // no-warning +} -- cgit v1.2.3