summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
authorDevin Coughlin <dcoughlin@apple.com>2017-11-25 14:57:42 +0000
committerDevin Coughlin <dcoughlin@apple.com>2017-11-25 14:57:42 +0000
commitcc5915a5e15d098952605556b2b7a75632fb41e3 (patch)
treef05a5ff589a30db450500626fc9f27b41201ad0b /clang/lib/Analysis
parent67e60434c30e9a53cf8c994a4c97a689732cfc8f (diff)
downloadbcm5719-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.cpp13
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);
}
OpenPOWER on IntegriCloud