aaronpuchert created this revision. aaronpuchert added a reviewer: aaron.ballman. aaronpuchert requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
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. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D106375 Files: clang/docs/ThreadSafetyAnalysis.rst Index: clang/docs/ThreadSafetyAnalysis.rst =================================================================== --- clang/docs/ThreadSafetyAnalysis.rst +++ clang/docs/ThreadSafetyAnalysis.rst @@ -640,8 +640,8 @@ 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); };
Index: clang/docs/ThreadSafetyAnalysis.rst =================================================================== --- clang/docs/ThreadSafetyAnalysis.rst +++ clang/docs/ThreadSafetyAnalysis.rst @@ -640,8 +640,8 @@ 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); };
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits