Skip to content

Commit 0e64a52

Browse files
committed
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
1 parent 44fa31f commit 0e64a52

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/docs/ThreadSafetyAnalysis.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,8 @@ mutex. For example:
640640
Mutex mu;
641641

642642
public:
643-
// For thread safety analysis only. Does not actually return mu.
644-
Mutex* getMu() RETURN_CAPABILITY(mu) { return 0; }
643+
// For thread safety analysis only. Does not need to be defined.
644+
Mutex* getMu() RETURN_CAPABILITY(mu);
645645

646646
void doSomething() REQUIRES(mu);
647647
};

0 commit comments

Comments
 (0)