|
ESBMC
Efficient SMT-based Context-Bounded Model Checker
|
Canonical, function-boundary C++ exception specification. More...
#include <exception_specification.h>
Public Types | |
| enum class | kindt { potentially_throwing , non_throwing , dynamic } |
Public Member Functions | |
| exception_specificationt () | |
| bool | is_restrictive () const |
| A restrictive spec can be violated at the function boundary. | |
Static Public Member Functions | |
| static exception_specificationt | from_type (const typet &type) |
| Decode the specification stored on a function typet. | |
| static const char * | kind_attribute () |
| Names of the named-sub attributes used on the typet. | |
| static const char * | types_attribute () |
Public Attributes | |
| kindt | kind |
| std::vector< irep_idt > | allowed_types |
Canonical, function-boundary C++ exception specification.
A C++ exception specification is a property of a function's boundary, not of any region of its body. It is violated only when exception handler search exits the function body with an exception the specification does not permit. This replaces the old executable THROW_DECL/THROW_DECL_END GOTO instructions, whose enforcement incorrectly depended on the nearest active try/catch region rather than the function frame.
The canonical representation lives on the function symbol's (legacy) typet as named-sub attributes so it survives GOTO-binary serialization and is available for declarations without bodies. goto_functiont caches a decoded copy for convenient executable access during symbolic execution.
|
strong |
| Enumerator | |
|---|---|
| potentially_throwing | No specification (or an explicitly throwing one): may throw anything. |
| non_throwing | C++11 noexcept (or noexcept(true)): violation calls std::terminate. |
| dynamic | Legacy dynamic spec throw(T...) (incl. empty throw()): violation calls std::unexpected. allowed_types lists the permitted exception type ids (matching the ids produced by clang_cpp_adjust's convert_exception_id); empty means nothing may escape. |
|
inline |
|
static |
Decode the specification stored on a function typet.
Returns a default (potentially_throwing) spec when no metadata is present.
|
inline |
A restrictive spec can be violated at the function boundary.
Plain potentially-throwing functions never violate their spec.
|
inlinestatic |
Names of the named-sub attributes used on the typet.
|
inlinestatic |
| std::vector<irep_idt> exception_specificationt::allowed_types |
| kindt exception_specificationt::kind |