diff options
author | Devin Coughlin <dcoughlin@apple.com> | 2016-11-11 21:31:38 +0000 |
---|---|---|
committer | Devin Coughlin <dcoughlin@apple.com> | 2016-11-11 21:31:38 +0000 |
commit | e477a0e5ec675ed3f15e746ef3f447faa2a1e419 (patch) | |
tree | fd5f97026852ab47a3dab1877b6380174ab7d879 /clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | |
parent | 4d6fb72aa93dee764f2dac5dcf324bf45f062e4b (diff) | |
download | bcm5719-llvm-e477a0e5ec675ed3f15e746ef3f447faa2a1e419.tar.gz bcm5719-llvm-e477a0e5ec675ed3f15e746ef3f447faa2a1e419.zip |
[analyzer] Teach RetainCountChecker about VTCompressionSessionEncodeFrame()
The context argument passed to VideoToolbox's
VTCompressionSessionEncodeFrame() function is ultimately passed to a callback
supplied when creating the compression session and so may be freed by that
callback. To suppress false positives in this case, teach the retain count
checker to stop tracking that argument.
This isn't suppressed by the usual callback context mechanism because the call
to VTCompressionSessionEncodeFrame() doesn't include the callback itself.
rdar://problem/27685213
llvm-svn: 286633
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index 13a4f87bd9d..26026dd9a26 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -1126,6 +1126,14 @@ RetainSummaryManager::getFunctionSummary(const FunctionDecl *FD) { // correctly. ScratchArgs = AF.add(ScratchArgs, 12, StopTracking); S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing); + } else if (FName == "VTCompressionSessionEncodeFrame") { + // The context argument passed to VTCompressionSessionEncodeFrame() + // is passed to the callback specified when creating the session + // (e.g. with VTCompressionSessionCreate()) which can release it. + // To account for this possibility, conservatively stop tracking + // the context. + ScratchArgs = AF.add(ScratchArgs, 5, StopTracking); + S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing); } else if (FName == "dispatch_set_context" || FName == "xpc_connection_set_context") { // <rdar://problem/11059275> - The analyzer currently doesn't have |