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 | 1d08fd9b7986dd2dd9969d5e40b2a329644e0e38 (patch) | |
tree | 7689e869785435f990f2fb19ef965c7f2163f29a | |
parent | 8a297e9f277fc8f34f57a59d2d75329e22520552 (diff) | |
download | bcm5719-llvm-1d08fd9b7986dd2dd9969d5e40b2a329644e0e38.tar.gz bcm5719-llvm-1d08fd9b7986dd2dd9969d5e40b2a329644e0e38.zip |
Correctly handle 'Class<...>' when examining Cocoa conventions in the static analyzer. Fixes a crash reported in <rdar://problem/8272168>. Patch by Henry Mason!
llvm-svn: 110289
-rw-r--r-- | clang/lib/Checker/CocoaConventions.cpp | 5 | ||||
-rw-r--r-- | clang/test/Analysis/retain-release.m | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Checker/CocoaConventions.cpp b/clang/lib/Checker/CocoaConventions.cpp index 3ba887ccc7e..b446a048d48 100644 --- a/clang/lib/Checker/CocoaConventions.cpp +++ b/clang/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/clang/test/Analysis/retain-release.m b/clang/test/Analysis/retain-release.m index c9c7d271347..064165aaf9e 100644 --- a/clang/test/Analysis/retain-release.m +++ b/clang/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(); +} + |