[clang] 0e64a52 - Thread safety analysis: Mock getter for private mutexes can be undefined
Aaron Puchert via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 23 05:49:55 PDT 2021
Author: Aaron Puchert
Date: 2021-07-23T14:46:02+02:00
New Revision: 0e64a525c12a0822683d3bdc51b6294b5265f860
URL: https://github.com/llvm/llvm-project/commit/0e64a525c12a0822683d3bdc51b6294b5265f860
DIFF: https://github.com/llvm/llvm-project/commit/0e64a525c12a0822683d3bdc51b6294b5265f860.diff
LOG: Thread safety analysis: Mock getter for private mutexes can be undefined
Usage in an annotation is no odr-use, so I think there needs to be no
definition. Upside is that in practice one will get linker errors if it
is actually odr-used instead of calling a function that returns 0.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D106375
Added:
Modified:
clang/docs/ThreadSafetyAnalysis.rst
Removed:
################################################################################
diff --git a/clang/docs/ThreadSafetyAnalysis.rst b/clang/docs/ThreadSafetyAnalysis.rst
index 651229f01d03..69046ba18b8c 100644
--- a/clang/docs/ThreadSafetyAnalysis.rst
+++ b/clang/docs/ThreadSafetyAnalysis.rst
@@ -640,8 +640,8 @@ mutex. For example:
Mutex mu;
public:
- // For thread safety analysis only. Does not actually return mu.
- Mutex* getMu() RETURN_CAPABILITY(mu) { return 0; }
+ // For thread safety analysis only. Does not need to be defined.
+ Mutex* getMu() RETURN_CAPABILITY(mu);
void doSomething() REQUIRES(mu);
};
More information about the cfe-commits
mailing list