[PATCH] D153131: [clang analysis][thread-safety] Handle return-by-reference...
Clement Courbet via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 16 06:05:20 PDT 2023
courbet created this revision.
courbet added a reviewer: delesley.
Herald added a reviewer: NoQ.
Herald added a project: All.
courbet requested review of this revision.
Herald added a project: clang.
...of guarded variables, when the function is not marked as requiring locks:
class Return {
Mutex mu;
Foo foo GUARDED_BY(mu);
Foo &returns_ref_locked() {
MutexLock lock(&mu);
return foo; // BAD
}
Foo &returns_ref_locks_required() SHARED_LOCKS_REQUIRED(mu) {
return foo; // OK
}
};
This is implemented as `-Wthread-safety-return` and not part of
`-Wthread-safety` for now.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D153131
Files:
clang/include/clang/Analysis/Analyses/ThreadSafety.h
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Analysis/ThreadSafety.cpp
clang/lib/Sema/AnalysisBasedWarnings.cpp
clang/test/SemaCXX/warn-thread-safety-analysis.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153131.532116.patch
Type: text/x-patch
Size: 7931 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230616/807cdf00/attachment.bin>
More information about the cfe-commits
mailing list