[all-commits] [llvm/llvm-project] c1bde0: [clang][ThreadSafety] Check trylock function succe...
Dan McArdle via All-commits
all-commits at lists.llvm.org
Mon Jun 24 06:29:34 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c1bde0a2cb640b3607e9568b9a57b292e1f82666
https://github.com/llvm/llvm-project/commit/c1bde0a2cb640b3607e9568b9a57b292e1f82666
Author: Dan McArdle <zingermc at gmail.com>
Date: 2024-06-24 (Mon, 24 Jun 2024)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/docs/ThreadSafetyAnalysis.rst
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/include/clang/Sema/ParsedAttr.h
M clang/lib/Analysis/ThreadSafety.cpp
M clang/lib/Sema/SemaDeclAttr.cpp
M clang/test/Sema/attr-capabilities.c
M clang/test/SemaCXX/warn-thread-safety-analysis.cpp
M clang/test/SemaCXX/warn-thread-safety-parsing.cpp
M clang/unittests/AST/ASTImporterTest.cpp
Log Message:
-----------
[clang][ThreadSafety] Check trylock function success and return types (#95290)
With this change, Clang will generate errors when trylock functions have
improper return types. Today, it silently fails to apply the trylock
attribute to these functions which may incorrectly lead users to believe
they have correctly acquired locks before accessing guarded data.
As a side effect of explicitly checking the success argument type, I
seem to have fixed a false negative in the analysis that could occur
when a trylock's success argument is an enumerator. I've added a
regression test to warn-thread-safety-analysis.cpp named
`TrylockSuccessEnumFalseNegative`.
This change also improves the documentation with descriptions of of the
subtle gotchas that arise from the analysis interpreting the success arg
as a boolean.
Issue #92408
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list