diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-08-05 00:19:24 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-08-05 00:19:24 +0000 |
commit | 4019c4f692e7b8b2d7a7b6a377c78337596052e4 (patch) | |
tree | 25fb2f2a40f05c29f31bd3f189a640f231617e17 | |
parent | eea0d9361de0c400a58bd7c1f23e3edee7b028d9 (diff) |
Correctly handle 'Class<...>' when examining Cocoa conventions in the static analyzer. Fixes a crash reported in <rdar://problem/8272168>. Patch by Henry Mason!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110289 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Checker/CocoaConventions.cpp | 5 | ||||
-rw-r--r-- | test/Analysis/retain-release.m | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/Checker/CocoaConventions.cpp b/lib/Checker/CocoaConventions.cpp index 3ba887ccc7..b446a048d4 100644 --- a/lib/Checker/CocoaConventions.cpp +++ b/lib/Checker/CocoaConventions.cpp @@ -173,9 +173,10 @@ bool cocoa::isCocoaObjectRef(QualType Ty) { if (!PT) return true; - // We assume that id<..>, id, and "Class" all represent tracked objects. + // We assume that id<..>, id, Class, and Class<..> all represent tracked + // objects. if (PT->isObjCIdType() || PT->isObjCQualifiedIdType() || - PT->isObjCClassType()) + PT->isObjCClassType() || PT->isObjCQualifiedClassType()) return true; // Does the interface subclass NSObject? diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m index c9c7d27134..064165aaf9 100644 --- a/test/Analysis/retain-release.m +++ b/test/Analysis/retain-release.m @@ -1358,3 +1358,12 @@ void test_blocks_1_indirect_retain_via_call(void) { } @end +// <rdar://problem/8272168> - Correcly handle Class<...> in Cocoa Conventions +// detector. + +@protocol Prot_R8272168 @end +Class <Prot_R8272168> GetAClassThatImplementsProt_R8272168(); +void r8272168() { + GetAClassThatImplementsProt_R8272168(); +} + |