|
ESBMC
Efficient SMT-based Context-Bounded Model Checker
|
Classes | |
| class | _Uses |
| class | _Rewrite |
Functions | |
| _scopes (module) | |
| _bindings (module, name) | |
| _builtin_lacks (base, attr) | |
| _class_lacks (classes, name, attr) | |
| _store_target (node) | |
| _call_attribute (node) | |
| _supported_call (node) | |
| _uses_by_attribute (module) | |
| _set (name, value, at) | |
| _insert_after (module, stmt, extra) | |
| _lower (module, use, binding, has, value) | |
| _mentioned (module) | |
| _reachable_otherwise (module, mentioned) | |
| _binding (module, use, scopes) | |
| lower_path_dependent_attributes (module) | |
Variables | |
| dict | _HOOKS |
| tuple | _SCOPES |
| keywords | |
| bases | |
Answer `getattr` with a default and `hasattr` on an attribute that a scope
adds to its own instance on only some paths (#8964).
The converter refuses such a store: the instance's struct cannot tell a path
that set the attribute from one that did not. When the attribute is stored
and read nowhere else, and only through `getattr` with a default or
`hasattr`, its value and whether it is set are two local variables instead:
b = B() b = B()
esbmc_has_b_code = False
if c: if c:
b.code = 1 esbmc_b_code = 1
esbmc_has_b_code = True
getattr(b, "code", 0) esbmc_b_code if esbmc_has_b_code else 0
hasattr(b, "code") esbmc_has_b_code
The receiver must be a name bound once, by constructing a class of the
module, in the one scope holding every use of the attribute. Anything that
could reach the attribute another way (a hook, an import, a dynamic name)
leaves the program unchanged.
|
protected |
The statement binding the one receiver of `use`, when one statement binds it, in the function or module scope of every use, and a store of the attribute sits in a block nested in that scope.
|
protected |
The nodes of `module` that bind `name`.
|
protected |
|
protected |
The attribute a `getattr` or `hasattr` call names: None when `node` is no such call, "" when the call does not name it by a string literal.
|
protected |
Whether class `name` of the module, and each class it derives from, leaves `attr` to its instances.
|
protected |
|
protected |
|
protected |
Every name and attribute name `module` mentions.
|
protected |
Whether something other than the nodes this pass rewrites may reach an attribute: another module, a hook, a class pattern, or a rebound getattr or hasattr.
|
protected |
The innermost scope of every node in `module`, by node id.
|
protected |
|
protected |
The attribute a plain `obj.attr = value` statement stores, or None.
|
protected |
Whether `node` is `getattr(obj, name, default)` with a default that cannot fail to evaluate, or `hasattr(obj, name)`.
|
protected |
Each attribute name's uses, or None when a use names it dynamically.
| preprocessor.path_dependent_attributes.lower_path_dependent_attributes | ( | module | ) |
Rewrite each attribute that qualifies, as the module docstring shows.
|
protected |
|
protected |
| preprocessor.path_dependent_attributes.bases |
| preprocessor.path_dependent_attributes.keywords |