[all-commits] [llvm/llvm-project] 6dd96d: [clang analysis][thread-safety] Handle return-by-r...
Clement Courbet via All-commits
all-commits at lists.llvm.org
Fri Sep 29 04:11:19 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6dd96d6e80e9b3679a6161c590c60e0e99549b89
https://github.com/llvm/llvm-project/commit/6dd96d6e80e9b3679a6161c590c60e0e99549b89
Author: Clement Courbet <courbet at google.com>
Date: 2023-09-29 (Fri, 29 Sep 2023)
Changed paths:
M clang/include/clang/Analysis/Analyses/ThreadSafety.h
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/Analysis/ThreadSafety.cpp
M clang/lib/Sema/AnalysisBasedWarnings.cpp
M clang/test/SemaCXX/warn-thread-safety-analysis.cpp
Log Message:
-----------
[clang analysis][thread-safety] Handle return-by-reference... (#67776)
...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
}
};
```
Review on Phabricator: https://reviews.llvm.org/D153131
More information about the All-commits
mailing list