[dead stores] whitelist more RAII guard types

Reviewed By: jeremydubreil

Differential Revision: D6490095

fbshipit-source-id: ae11859
master
Sam Blackshear 7 years ago committed by Facebook Github Bot
parent f0f1e97ae2
commit 6799e7a7fb

@ -104,10 +104,17 @@ let checker {Callbacks.tenv; summary; proc_desc} : Specs.summary =
let matcher_scope_guard =
QualifiedCppName.Match.of_fuzzy_qual_names
[ (* C++ *)
"folly::RWSpinLock::ReadHolder"
"faiss::ScopeDeleter"
; "folly::RWSpinLock::ReadHolder"
; "folly::RWSpinLock::WriteHolder"
; "folly::SpinLockGuard"
; "folly::ScopeGuard"
; "folly::SharedMutex::ReadHolder"
; "folly::SharedMutex::WriteHolder"
; "folly::SharedMutexReadPriority::ReadHolder"
; "folly::SharedMutexReadPriority::WriteHolder"
; "folly::SharedMutexWritePriority::ReadHolder"
; "folly::SharedMutexWritePriority::WriteHolder"
; "folly::SpinLockGuard"
; "std::lock_guard"
; "std::scoped_lock"
; "std::unique_lock" (* Obj-C *)
@ -162,4 +169,3 @@ let checker {Callbacks.tenv; summary; proc_desc} : Specs.summary =
in
List.iter (CFG.nodes cfg) ~f:report_on_node ;
summary

@ -13,6 +13,13 @@
namespace folly {
class ScopeGuard {};
class SharedMutex {
public:
class ReadHolder {};
class WriteHolder {};
};
} // namespace folly
namespace dead_stores {
@ -287,9 +294,13 @@ int* sentinel_ptr_ok(int* j) {
void scope_guard_ok() {
// realistically, it would be something like guard = folly::makeGuard();
folly::ScopeGuard* guard = nullptr;
folly::ScopeGuard guard;
}
void read_holder_ok() { folly::SharedMutex::ReadHolder guard; }
void write_holder_ok() { folly::SharedMutex::WriteHolder guard; }
struct S {
~S() {}
};

@ -6,7 +6,7 @@ codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::dead_then_live_bad, 1,
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::easy_bad, 0, DEAD_STORE, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::init_capture_no_call_bad, 1, DEAD_STORE, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::init_capture_reassign_bad, 1, DEAD_STORE, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::lambda_bad::lambda_dead_stores.cpp:153:11_operator(), 1, DEAD_STORE, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::lambda_bad::lambda_dead_stores.cpp:160:11_operator(), 1, DEAD_STORE, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::plus_plus1_bad, 2, DEAD_STORE, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::plus_plus2_bad, 2, DEAD_STORE, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::plus_plus3_bad, 2, DEAD_STORE, [Write of unused value]

Loading…
Cancel
Save