Macros | |
#define | ein_consumable(__x) |
Each class that uses any typestate annotations must first be marked using this attribute. | |
#define | ein_callable_when(...) |
#define | ein_param_typestate(...) |
#define | ein_return_typestate(...) |
#define | ein_moving ein_return_typestate("consumed") ein_param_typestate("unconsumed") |
[[return_typestate("consumed")]] [[param_typestate("unconsumed")]] | |
#define | ein_set_typestate(...) |
#define | ein_test_typestate |
#define | ein_test_typestate(...) |
Enabled in clang
by passing -fsanitize=consumed
#define ein_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.
Definition at line 52 of file typestate.hpp.
#define ein_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".
Definition at line 38 of file typestate.hpp.
#define ein_moving ein_return_typestate("consumed") ein_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.
Definition at line 100 of file typestate.hpp.
#define ein_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.
Definition at line 67 of file typestate.hpp.
#define ein_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.
Definition at line 88 of file typestate.hpp.
#define ein_set_typestate | ( | ... | ) |
Annotate methods that transition an object into a new state.
The new state must be "unconsumed"
, "consumed"
, or "unknown"
.
Definition at line 113 of file typestate.hpp.
#define ein_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"
.
Definition at line 127 of file typestate.hpp.
#define ein_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"
.
Definition at line 127 of file typestate.hpp.