diff options
| author | Ted Kremenek <kremenek@apple.com> | 2010-09-10 03:05:40 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2010-09-10 03:05:40 +0000 |
| commit | e495c990557f1a89350a02a37d6d1699c6d17e52 (patch) | |
| tree | 4ec33f3e0269e6447e2a1c49be502dc5cd25ca55 /clang/test/Analysis | |
| parent | ed12f1b9f9d689fceae4c704019fb41837bc2375 (diff) | |
| download | bcm5719-llvm-e495c990557f1a89350a02a37d6d1699c6d17e52.tar.gz bcm5719-llvm-e495c990557f1a89350a02a37d6d1699c6d17e52.zip | |
Implement: <rdar://problem/6351970> rule request: warn if @synchronized mutex can be nil
llvm-svn: 113573
Diffstat (limited to 'clang/test/Analysis')
| -rw-r--r-- | clang/test/Analysis/misc-ps.m | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Analysis/misc-ps.m b/clang/test/Analysis/misc-ps.m index 1d6e6f6153e..09f397041fb 100644 --- a/clang/test/Analysis/misc-ps.m +++ b/clang/test/Analysis/misc-ps.m @@ -1094,4 +1094,19 @@ void test_enum_cases_positive(enum Cases C) { *p = 0xDEADBEEF; // expected-warning{{Dereference of null pointer}} } +// <rdar://problem/6351970> rule request: warn if synchronization mutex can be nil +void rdar6351970() { + id x = 0; + @synchronized(x) {} // expected-warning{{Nil value used as mutex for @synchronized() (no synchronization will occur)}} +} + +void rdar6351970_b(id x) { + if (!x) + @synchronized(x) {} // expected-warning{{Nil value used as mutex for @synchronized() (no synchronization will occur)}} +} + +void rdar6351970_c() { + id x; + @synchronized(x) {} // expected-warning{{Uninitialized value used as mutex for @synchronized}} +} |

