|
Hint 0.1.0
|
Enabled in clang by passing -fsanitize=consumed
More...
Macros | |
| #define | hint_consumable(__x) |
| Each class that uses any typestate annotations must first be marked using this attribute. | |
| #define | hint_callable_when(...) |
| #define | hint_param_typestate(...) |
| #define | hint_return_typestate(...) |
| #define | hint_moving hint_return_typestate("consumed") hint_param_typestate("unconsumed") |
[[return_typestate("consumed")]] [[param_typestate("unconsumed")]] | |
| #define | hint_set_typestate(...) |
| #define | hint_test_typestate(...) |
Enabled in clang by passing -fsanitize=consumed
| #define hint_callable_when | ( | ... | ) |
Use 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.
| #define hint_consumable | ( | __x | ) |
Each class that uses any typestate annotations must first be marked using this attribute.
Failure to do so will result in a warning. This attribute accepts a single parameter that must be one of the following: "unknown", "consumed", or "unconsumed".
| #define hint_moving hint_return_typestate("consumed") hint_param_typestate("unconsumed") |
[[return_typestate("consumed")]] [[param_typestate("unconsumed")]]
Short-hand for indicating that this argument was moved and is now "consumed". Assumes it was "unconsumed" before.
| #define hint_param_typestate | ( | ... | ) |
This attribute specifies expectations about function parameters. Calls to a 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.
| #define hint_return_typestate | ( | ... | ) |
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.
When 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.
| #define hint_set_typestate | ( | ... | ) |
Annotate methods that transition an object into a new state.
The new state must be "unconsumed", "consumed", or "unknown".
| #define hint_test_typestate | ( | ... | ) |
Use to indicate that a method returns true if the object is in the specified state.
The state must be "unconsumed", "consumed", or "unknown".