From aac4d21ba7b30ad94faf02477e0b0b6b66ab3ba5 Mon Sep 17 00:00:00 2001
From: Caitlin Sadowski
Query for these features with __has_attribute(ns_consumed), __has_attribute(ns_returns_retained), etc.
+ + +Clang supports additional attributes for checking basic locking policies in +multithreaded programs. +Clang currently parses the following list of attributes, although +the implementation for these annotations is currently in development. +For more details, see the +GCC implementation. +
+ +Use __attribute__((guarded_var)) on a variable declaration to +specify that the variable must be accessed while holding some lock.
+ +Use __attribute__((pt_guarded_var)) on a pointer declaration to +specify that the pointer must be dereferenced while holding some lock.
+ +Use __attribute__((lockable)) on a class definition to specify +that it has a lockable type (e.g. a Mutex class). This annotation is primarily +used to check consistency.
+ +Use __attribute__((scoped_lockable)) on a class definition to +specify that it has a "scoped" lockable type. Objects of this type will acquire +the lock upon construction and release it upon going out of scope. + This annotation is primarily used to check +consistency.
+ +Use __attribute__((no_thread_safety_analysis)) on a function +declaration to specify that the thread safety analysis should not be run on that +function. This attribute provides an escape hatch (e.g. for situations when it +is difficult to annotate the locking policy).
+