ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
python_consteval.cpp File Reference
#include <python-frontend/consteval/python_consteval.h>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <functional>
#include <unordered_set>
Include dependency graph for python_consteval.cpp:

Functions

static double round_ties_to_even_consteval (const double value)
static double round_to_ndigits_ties_even_consteval (const double value, const int ndigits)
static bool int_equals_double (long long i, double f)
static bool pyconst_equal (const PyConstValue &lhs, const PyConstValue &rhs)
static bool body_has_stmt_kind (const nlohmann::json &body, std::initializer_list< const char * > kinds)
 Generic recursive scan: true if any statement (or nested block) has a _type listed in kinds.
static bool contains_bytes_literal (const nlohmann::json &node)
static bool body_has_unfoldable_stmts (const nlohmann::json &body)
 Bodies carrying properties that must be verified independently: an Assert (must reach the solver) or a nested FunctionDef (closures are unmodeled), and bodies handling bytes literals.
static bool body_has_control_flow (const nlohmann::json &body)
 Control flow whose branches matter for coverage/branch analysis.
static bool is_recursively_immutable (const PyConstValue &v)
static std::unordered_set< std::string > collect_unsafe_container_names (const nlohmann::json &ast)

Function Documentation

◆ body_has_control_flow()

bool body_has_control_flow ( const nlohmann::json & body)
static

Control flow whose branches matter for coverage/branch analysis.

Blocks folding only on the conservative call-site pre-scan path (see python_consteval::allow_control_flow_).

◆ body_has_stmt_kind()

bool body_has_stmt_kind ( const nlohmann::json & body,
std::initializer_list< const char * > kinds )
static

Generic recursive scan: true if any statement (or nested block) has a _type listed in kinds.

◆ body_has_unfoldable_stmts()

bool body_has_unfoldable_stmts ( const nlohmann::json & body)
static

Bodies carrying properties that must be verified independently: an Assert (must reach the solver) or a nested FunctionDef (closures are unmodeled), and bodies handling bytes literals.

Always blocks folding, regardless of control-flow permission.

◆ collect_unsafe_container_names()

std::unordered_set< std::string > collect_unsafe_container_names ( const nlohmann::json & ast)
static

◆ contains_bytes_literal()

bool contains_bytes_literal ( const nlohmann::json & node)
static

◆ int_equals_double()

bool int_equals_double ( long long i,
double f )
static

◆ is_recursively_immutable()

bool is_recursively_immutable ( const PyConstValue & v)
static

◆ pyconst_equal()

bool pyconst_equal ( const PyConstValue & lhs,
const PyConstValue & rhs )
static

◆ round_ties_to_even_consteval()

double round_ties_to_even_consteval ( const double value)
static

◆ round_to_ndigits_ties_even_consteval()

double round_to_ndigits_ties_even_consteval ( const double value,
const int ndigits )
static