diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-04-29 16:03:59 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-04-29 16:03:59 +0000 |
commit | a3f4540eba16e23e4589e032260ddff06f363e82 (patch) | |
tree | 439b2d923f0acae58ccf3ee28d14f56a362628f5 | |
parent | 5fa93d5285ed68a0819521f4681755ae696b996f (diff) |
Add test case for transfer function logic for OSCompareAndSwap32Barrier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70383 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Analysis/NSString.m | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/test/Analysis/NSString.m b/test/Analysis/NSString.m index 3f2b09189e..63b8ef8301 100644 --- a/test/Analysis/NSString.m +++ b/test/Analysis/NSString.m @@ -1,9 +1,9 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang-cc -arch i386 -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && +// RUN: clang-cc -arch i386 -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s -// NOTWORK: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s && -// NOTWORK: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// NOTWORK: clang-cc -arch i386 -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s && +// NOTWORK: clang-cc -arch i386 -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s //===----------------------------------------------------------------------===// // The following code is reduced using delta-debugging from @@ -14,6 +14,7 @@ // both svelte and portable to non-Mac platforms. //===----------------------------------------------------------------------===// +typedef int int32_t; typedef const void * CFTypeRef; typedef const struct __CFString * CFStringRef; typedef const struct __CFAllocator * CFAllocatorRef; @@ -235,6 +236,15 @@ void testOSCompareAndSwap() { [old release]; } +void testOSCompareAndSwap32Barrier() { + NSString *old = 0; + NSString *s = [[NSString alloc] init]; // no-warning + if (!OSAtomicCompareAndSwap32Barrier((int32_t) 0, (int32_t) s, (int32_t*) &old)) + [s release]; + else + [old release]; +} + void test_objc_atomicCompareAndSwap() { NSString *old = 0; NSString *s = [[NSString alloc] init]; // no-warning |