ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
clang_cpp_exception_id.h File Reference
#include <util/irep/std_types.h>
#include <util/symtab/namespace.h>
#include <string>
#include <vector>
Include dependency graph for clang_cpp_exception_id.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void convert_exception_id (const namespacet &ns, const typet &type, const std::string &suffix, std::vector< irep_idt > &ids, bool is_catch=false)
 The catchable-type ids a thrown or caught type resolves to, most derived first.
bool finalize_exception_specification (const namespacet &ns, typet &type)
 Resolve a function type's dynamic exception specification.

Function Documentation

◆ convert_exception_id()

void convert_exception_id ( const namespacet & ns,
const typet & type,
const std::string & suffix,
std::vector< irep_idt > & ids,
bool is_catch = false )

The catchable-type ids a thrown or caught type resolves to, most derived first.

Shared rather than a member of clang_cpp_adjust because the IREP2 C++ pass needs the same answer and the function reads nothing but the namespace (docs/roadmap/scope-clang-cpp-irep2.md §3.3).

◆ finalize_exception_specification()

bool finalize_exception_specification ( const namespacet & ns,
typet & type )

Resolve a function type's dynamic exception specification.

The converter stashes the declared types of a throw(T...) under "exception_spec_decl"; this turns them into exception ids and stores the list under exception_specificationt's types_attribute(), returning whether it did. A no-op for any other kind of specification.

Shared for the same reason convert_exception_id is: the IREP2 C++ pass has to reach the same answer, and this reads nothing but the namespace. Left unresolved, the spec permits nothing and every throw through such a function reports "exception specification violated" (docs/roadmap/scope-clang-cpp-irep2.md §7.7).