summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wailes <chris.wailes@gmail.com>2013-10-21 20:54:06 +0000
committerChris Wailes <chris.wailes@gmail.com>2013-10-21 20:54:06 +0000
commit155df7143f44af631ae215952aa904bf27923d4f (patch)
tree40980534620aaa2a704d1e6b9a431173daa29e72
parent6a7a446af4769cda9ee5b6b6ac256be065a45c87 (diff)
downloadbcm5719-llvm-155df7143f44af631ae215952aa904bf27923d4f.tar.gz
bcm5719-llvm-155df7143f44af631ae215952aa904bf27923d4f.zip
Updated and added to the Consumed documentation.
llvm-svn: 193120
-rw-r--r--clang/docs/LanguageExtensions.rst52
1 files changed, 41 insertions, 11 deletions
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index cd526c7bfa8..ac2658c4db2 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -2115,24 +2115,54 @@ properties, specifically for unique objects that have a single owning reference.
The following attributes are currently supported, although **the implementation
for these annotations is currently in development and are subject to change.**
-``consumes``
-------------
+``consumable``
+--------------
-Use ``__attribute__((consumes))`` on a method that transitions an object into
-the consumed state.
+Each class that uses any of the following annotations must first be marked
+using the consumable attribute. Failure to do so will result in a warning.
-``callable_when_unconsumed``
+``set_typestate(new_state)``
----------------------------
-Use ``__attribute__((callable_when_unconsumed))`` to indicate that a method may
-only be called when the object is not in the consumed state.
+Annotate methods that transition an object into a new state with
+``__attribute__((set_typestate(new_state)))``. The new new state must be
+unconsumed, consumed, or unknown.
-``tests_unconsumed``
---------------------
+``callable_when(...)``
+----------------------
+
+Use ``__attribute__((callable_when(...)))`` to indicate what states a method
+may be called in. Valid states are unconsumed, consumed, or unknown. Each
+argument to this attribute must be a quoted string. E.g.:
+
+``__attribute__((callable_when("unconsumed", "unknown")))``
+
+``tests_typestate(tested_state)``
+---------------------------------
+
+Use ``__attribute__((tests_typestate(tested_state)))`` to indicate that a method
+returns true if the object is in the specified state..
+
+``param_typestate(expected_state)``
+-----------------------------------
+
+This attribute specifies expectations about function parameters. Calls to an
+function with annotated parameters will issue a warning if the corresponding
+argument isn't in the expected state. The attribute is also used to set the
+initial state of the parameter when analyzing the function's body.
+
+``return_typestate(ret_state)``
+-------------------------------
-Use `__attribute__((tests_unconsumed))`` to indicate that a method returns true
-if the object is in the unconsumed state.
+The ``return_typestate`` attribute can be applied to functions or parameters.
+When applied to a function the attribute specifies the state of the returned
+value. The function's body is checked to ensure that it always returns a value
+in the specified state. On the caller side, values returned by the annotated
+function are initialized to the given state.
+If the attribute is applied to a function parameter it modifies the state of
+an argument after a call to the function returns. The function's body is
+checked to ensure that the parameter is in the expected state before returning.
Type Safety Checking
====================
OpenPOWER on IntegriCloud