+cfe-dev -- in case anyone knows why this happens.

Thanks!

On Sat, Apr 23, 2016 at 1:41 PM, RJ Ryan <rr...@alum.mit.edu> wrote:

> Hi there,
>
> The following code only produces thread safety warnings for me in
> get_foo_copy, not get_foo_reference. Is this expected? Sorry if this is a
> FAQ / known issue.
>
> $ clang --version
> Apple LLVM version 7.0.2 (clang-700.1.81)
> Target: x86_64-apple-darwin15.3.0
> Thread model: posix
>
> The problem also seems present on clang 3.8.0:
> https://godbolt.org/g/37DqNy
>
> Best,
> RJ
>
> (with the usual thread annotation definitions)
>
> class CAPABILITY("mutex") Mutex {
>   public:
>     Mutex() {}
>     inline void lock() ACQUIRE() {}
>     inline void unlock() RELEASE() {}
> };
>
> class Foo {
>   public:
>     int& get_foo_reference() {
>         return foo_;
>     }
>
>     int get_foo_copy() {
>         return foo_;
>     }
>
>   private:
>     Mutex foo_lock_;
>     int foo_ GUARDED_BY(foo_lock_);
> };
>
>
_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to