From b92909fe71beee9958d49ab2ffd31b721b0a524d Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Fri, 6 Oct 2017 03:30:24 -0700 Subject: [PATCH] [thread-safety][c++] Add models for several synchronization operations Summary: Model folly::SharedMutex lock and unlock operations, some apache::thrift::concurrency::ReadWriteMutex operations, some folly::RWSpinLock operations, and folly::MicroSpinLock operations. Reviewed By: sblackshear Differential Revision: D5974225 fbshipit-source-id: 19e2816 --- infer/src/checkers/ThreadSafety.ml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/infer/src/checkers/ThreadSafety.ml b/infer/src/checkers/ThreadSafety.ml index 1e15f2df9..55ca1099f 100644 --- a/infer/src/checkers/ThreadSafety.ml +++ b/infer/src/checkers/ThreadSafety.ml @@ -55,7 +55,16 @@ module TransferFunctions (CFG : ProcCfg.S) = struct let get_lock_model = let is_cpp_lock = let matcher_lock = - QualifiedCppName.Match.of_fuzzy_qual_names ["std::mutex::lock"; "std::unique_lock::lock"] + QualifiedCppName.Match.of_fuzzy_qual_names + [ "apache::thrift::concurrency::ReadWriteMutex::acquireRead" + ; "apache::thrift::concurrency::ReadWriteMutex::acquireWrite" + ; "folly::MicroSpinLock::lock" + ; "folly::RWSpinLock::lock" + ; "folly::RWSpinLock::lock_shared" + ; "folly::SharedMutexImpl::lockExclusiveImpl" + ; "folly::SharedMutexImpl::lockSharedImpl" + ; "std::mutex::lock" + ; "std::unique_lock::lock" ] in let matcher_lock_constructor = QualifiedCppName.Match.of_fuzzy_qual_names @@ -70,9 +79,15 @@ module TransferFunctions (CFG : ProcCfg.S) = struct and is_cpp_unlock = let matcher = QualifiedCppName.Match.of_fuzzy_qual_names - [ "std::mutex::unlock" - ; "std::unique_lock::unlock" + [ "apache::thrift::concurrency::ReadWriteMutex::release" + ; "folly::MicroSpinLock::unlock" + ; "folly::RWSpinLock::unlock" + ; "folly::RWSpinLock::unlock_shared" + ; "folly::SharedMutexImpl::unlock" + ; "folly::SharedMutexImpl::unlock_shared" ; "std::lock_guard::~lock_guard" + ; "std::mutex::unlock" + ; "std::unique_lock::unlock" ; "std::unique_lock::~unique_lock" ] in fun pname ->