From 63fa667c68740ef3430bf30876550b770254ad28 Mon Sep 17 00:00:00 2001 From: Caitlin Sadowski Date: Thu, 28 Jul 2011 20:12:35 +0000 Subject: Added basic parsing for all remaining attributes, thread safety analysis. This includes checking that the attributes are applied in the correct contexts and with the correct number of arguments. llvm-svn: 136383 --- clang/docs/LanguageExtensions.html | 149 +++++++++++++++++++++++++++++++++---- 1 file changed, 133 insertions(+), 16 deletions(-) (limited to 'clang/docs/LanguageExtensions.html') diff --git a/clang/docs/LanguageExtensions.html b/clang/docs/LanguageExtensions.html index 37ea0396e0e..804080d3266 100644 --- a/clang/docs/LanguageExtensions.html +++ b/clang/docs/LanguageExtensions.html @@ -89,11 +89,24 @@
  • Static Analysis-Specific Extensions
  • Thread Safety Annotation Checking
  • @@ -1109,15 +1122,12 @@ 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

    +

    no_thread_safety_analysis

    -

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

    +

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

    lockable

    @@ -1133,12 +1143,119 @@ the lock upon construction and release it upon going out of scope. This annotation is primarily used to check consistency.

    -

    no_thread_safety_analysis

    +

    guarded_var

    -

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

    +

    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.

    + +

    guarded_by(l)

    + +

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

    + +

    pt_guarded_by(l)

    + +

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

    + +

    acquired_before(...)

    + +

    Use __attribute__((acquired_before(...))) on a declaration +of a lockable variable to specify that the lock must be acquired before all +attribute arguments. Arguments must be lockable type, and there must be at +least one argument.

    + +

    acquired_after(...)

    + +

    Use __attribute__((acquired_after(...))) on a declaration +of a lockable variable to specify that the lock must be acquired after all +attribute arguments. Arguments must be lockable type, and there must be at +least one argument.

    + +

    exclusive_lock_function(...)

    + +

    Use __attribute__((exclusive_lock_function(...))) on a function +declaration to specify that the function acquires all listed locks +exclusively. This attribute takes zero or more +arguments: either of lockable type or integers indexing into +function parameters of lockable type. If no arguments are given, the acquired +lock is implicitly this of the enclosing object.

    + +

    shared_lock_function(...)

    + +

    Use __attribute__((shared_lock_function(...))) on a function +declaration to specify that the function acquires all listed locks, although + the locks may be shared (e.g. read locks). +This attribute takes zero or more +arguments: either of lockable type or integers indexing into +function parameters of lockable type. If no arguments are given, the acquired +lock is implicitly this of the enclosing object.

    + +

    exclusive_trylock_function(...)

    + +

    Use __attribute__((exclusive_lock_function(...))) on a function +declaration to specify that the function will try (without blocking) to acquire +all listed locks exclusively. This attribute takes one or more +arguments. The first argument is an integer or boolean value specifying the +return value of a successful lock acquisition. The remaining arugments are +either of lockable type or integers indexing into +function parameters of lockable type. If only one argument is given, the +acquired lock is implicitly this of the enclosing object.

    + +

    shared_trylock_function(...)

    + +

    Use __attribute__((shared_lock_function(...))) on a function +declaration to specify that the function will try (without blocking) to acquire +all listed locks, although + the locks may be shared (e.g. read locks). +This attribute takes one or more +arguments. The first argument is an integer or boolean value specifying the +return value of a successful lock acquisition. The remaining arugments are +either of lockable type or integers indexing into +function parameters of lockable type. If only one argument is given, the +acquired lock is implicitly this of the enclosing object.

    + +

    unlock_function(...)

    + +

    Use __attribute__((unlock_function(...))) on a function +declaration to specify that the function release all listed locks. + This attribute takes zero or more +arguments: either of lockable type or integers indexing into +function parameters of lockable type. If no arguments are given, the acquired +lock is implicitly this of the enclosing object.

    + +

    lock_returned(l)

    + +

    Use __attribute__((lock_returned(l))) on a function +declaration to specify that the function returns lock l (l must be of lockable +type). This annotation is used +to aid in resolving lock expressions.

    + +

    locks_excluded(...)

    + +

    Use __attribute__((locks_excluded(...))) on a function declaration +to specify that the function must not be called with the listed locks. +Arguments must be lockable type, and there must be at +least one argument.

    + +

    exclusive_locks_required(...)

    + +

    Use __attribute__((exclusive_locks_required(...))) on a function +declaration to specify that the function must be called while holding the listed +exclusive locks. Arguments must be lockable type, and there must be at +least one argument.

    + +

    shared_locks_required(...)

    + +

    Use __attribute__((shared_locks_required(...))) on a function +declaration to specify that the function must be called while holding the listed +shared locks. Arguments must be lockable type, and there must be at +least one argument.

    -- cgit v1.2.3