diff options
author | Devin Coughlin <dcoughlin@apple.com> | 2017-11-25 14:57:42 +0000 |
---|---|---|
committer | Devin Coughlin <dcoughlin@apple.com> | 2017-11-25 14:57:42 +0000 |
commit | cc5915a5e15d098952605556b2b7a75632fb41e3 (patch) | |
tree | f05a5ff589a30db450500626fc9f27b41201ad0b /clang/lib/Analysis | |
parent | 67e60434c30e9a53cf8c994a4c97a689732cfc8f (diff) | |
download | bcm5719-llvm-cc5915a5e15d098952605556b2b7a75632fb41e3.tar.gz bcm5719-llvm-cc5915a5e15d098952605556b2b7a75632fb41e3.zip |
[analyzer] Teach RetainCountChecker about CoreMedia APIs
Teach the retain-count checker that CoreMedia reference types use
CoreFoundation-style reference counting. This enables the checker
to catch leaks and over releases of those types.
rdar://problem/33599757
llvm-svn: 318979
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r-- | clang/lib/Analysis/CocoaConventions.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Analysis/CocoaConventions.cpp b/clang/lib/Analysis/CocoaConventions.cpp index be1262dc991..4d57623e216 100644 --- a/clang/lib/Analysis/CocoaConventions.cpp +++ b/clang/lib/Analysis/CocoaConventions.cpp @@ -47,12 +47,19 @@ bool cocoa::isRefType(QualType RetTy, StringRef Prefix, return Name.startswith(Prefix); } +/// Returns true when the passed-in type is a CF-style reference-counted +/// type from the DiskArbitration framework. +static bool isDiskArbitrationAPIRefType(QualType T) { + return cocoa::isRefType(T, "DADisk") || + cocoa::isRefType(T, "DADissenter") || + cocoa::isRefType(T, "DASessionRef"); +} + bool coreFoundation::isCFObjectRef(QualType T) { return cocoa::isRefType(T, "CF") || // Core Foundation. cocoa::isRefType(T, "CG") || // Core Graphics. - cocoa::isRefType(T, "DADisk") || // Disk Arbitration API. - cocoa::isRefType(T, "DADissenter") || - cocoa::isRefType(T, "DASessionRef"); + cocoa::isRefType(T, "CM") || // Core Media. + isDiskArbitrationAPIRefType(T); } |