From aac4d21ba7b30ad94faf02477e0b0b6b66ab3ba5 Mon Sep 17 00:00:00 2001 From: Caitlin Sadowski Date: Thu, 28 Jul 2011 17:21:07 +0000 Subject: Added parsing for guarded_var, pt_guarded_var, lockable, scoped_lockable, and no_thread_safety_analysis attributes, all for thread safety analysis llvm-svn: 136364 --- clang/docs/LanguageExtensions.html | 52 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'clang/docs/LanguageExtensions.html') diff --git a/clang/docs/LanguageExtensions.html b/clang/docs/LanguageExtensions.html index 528315b820e..877217f9aa5 100644 --- a/clang/docs/LanguageExtensions.html +++ b/clang/docs/LanguageExtensions.html @@ -87,6 +87,14 @@
  • Static Analysis-Specific Extensions
  • +
  • Thread Safety Annotation Checking
  • + @@ -1088,6 +1096,50 @@ balance in some way.

    Query for these features with __has_attribute(ns_consumed), __has_attribute(ns_returns_retained), etc.

    + + +

    Thread-Safety Annotation Checking

    + + +

    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. +

    + +

    guarded_var

    + +

    Use __attribute__((guarded_var)) on a variable declaration to +specify that the variable must be accessed while holding some lock.

    + +

    pt_guarded_var

    + +

    Use __attribute__((pt_guarded_var)) on a pointer declaration to +specify that the pointer must be dereferenced while holding some lock.

    + +

    lockable

    + +

    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.

    + +

    scoped_lockable

    + +

    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.

    + +

    no_thread_safety_analysis

    + +

    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).

    + -- cgit v1.2.3