[clang analysis] Make mutex guard detection more reliable.
authorEli Friedman <efriedma@quicinc.com>
Mon, 30 Mar 2020 18:45:39 +0000 (11:45 -0700)
committerEli Friedman <efriedma@quicinc.com>
Mon, 30 Mar 2020 18:46:02 +0000 (11:46 -0700)
commit24485aec4750255574a9a8211b3aef1ce00e83b6
treeb9743305a3b07ae310a5c0a62bc8b971d6a7f0d3
parenta235215415dc42da558d52070a2ca6eb9ad10d86
[clang analysis] Make mutex guard detection more reliable.

-Wthread-safety was failing to detect certain AST patterns it should
detect. Make the pattern detection a bit more comprehensive.

Due to an unrelated bug involving template instantiation, this showed up
as a regression in 10.0 vs. 9.0 in the original bug report. The included
testcase fails on older versions of clang, though.

Fixes https://bugs.llvm.org/show_bug.cgi?id=45323 .

Differential Revision: https://reviews.llvm.org/D76943
clang/lib/Analysis/ThreadSafety.cpp
clang/test/SemaCXX/warn-thread-safety-analysis.cpp