21#ifndef GCC_ANALYZER_REGION_MODEL_H
22#define GCC_ANALYZER_REGION_MODEL_H
38#include "text-art/widget.h"
39#include "text-art/dump.h"
55 void put (T src, T dst);
73 for (
int i = 0;
i < num_svalues;
i++)
110 T src (T::from_int (
i));
156 return !(*
this == other);
180 std::unique_ptr<json::object>
to_json ()
const;
182 std::unique_ptr<text_art::tree_widget>
246struct append_regions_cb_data;
259 const svalue *typeinfo_sval,
260 const svalue *destructor_sval)
270 void dump (FILE *fp,
bool simple)
const;
274 std::unique_ptr<json::object>
to_json ()
const;
276 std::unique_ptr<text_art::tree_widget>
310 return !(*
this == other);
318 void dump (FILE *fp,
bool simple,
bool multiline)
const;
324 std::unique_ptr<json::object>
to_json ()
const;
326 std::unique_ptr<text_art::tree_widget>
336 bool *out_unknown_side_effects,
345 bool unknown_side_effects,
353 const svalue *num_bytes_sval);
385 std::unique_ptr<rejected_constraint> *out);
395 const gcall *call_stmt,
401 const svalue **out_result,
403 const gcall *call_stmt,
404 bool eval_return_svalue =
true);
415 bool add_nonnull_constraint =
true)
const;
433 const svalue *num_bytes_sval,
438 const svalue *num_bytes_sval,
443 const svalue *num_bytes_sval,
463 std::unique_ptr<rejected_constraint> *out);
468 bool update_state_machine =
false,
511 return m_mgr->get_range_manager ();
529 struct append_regions_cb_data *
data);
555 const svalue *copied_sval,
566 const svalue *old_ptr_sval,
567 const svalue *new_ptr_sval);
572 const svalue *new_ptr_sval);
598 bool include_terminator,
599 const svalue **out_sval)
const;
618 callback (model, prev_model, retval, ctxt);
664 std::unique_ptr<rejected_constraint> *out);
671 std::unique_ptr<rejected_constraint> *out);
701 const gcond *cond_stmt,
703 std::unique_ptr<rejected_constraint> *out);
707 std::unique_ptr<rejected_constraint> *out);
709 const ggoto *goto_stmt,
716 std::unique_ptr<rejected_constraint> *out);
752 const svalue *sym_byte_offset,
753 const svalue *num_bytes_sval,
764 tree format_attr)
const;
820 virtual bool warn (std::unique_ptr<pending_diagnostic> d,
825 virtual void add_note (std::unique_ptr<pending_note> pn) = 0;
829 virtual void add_event (std::unique_ptr<checker_event> event) = 0;
886 virtual void bifurcate (std::unique_ptr<custom_edge_info> info) = 0;
899 unsigned *out_sm_idx,
900 std::unique_ptr<sm_context> *out_sm_context) = 0;
905 unsigned *out_sm_idx,
906 std::unique_ptr<sm_context> *out_sm_context)
909 out_sm_idx, out_sm_context);
913 unsigned *out_sm_idx)
919 unsigned *out_sm_idx)
942 bool warn (std::unique_ptr<pending_diagnostic>,
942 bool warn (std::unique_ptr<pending_diagnostic>, {
…}
944 void add_note (std::unique_ptr<pending_note>)
override;
945 void add_event (std::unique_ptr<checker_event>)
override;
952 const svalue *rhs ATTRIBUTE_UNUSED)
override
961 bool is_mutable ATTRIBUTE_UNUSED)
override
965 tree rhs ATTRIBUTE_UNUSED)
override
976 void bifurcate (std::unique_ptr<custom_edge_info> info)
override;
985 std::unique_ptr<sm_context> *)
override
1023 bool warn (std::unique_ptr<pending_diagnostic> d,
1027 return m_inner->warn (std::move (d), custom_finder);
1023 bool warn (std::unique_ptr<pending_diagnostic> d, {
…}
1032 void add_note (std::unique_ptr<pending_note> pn)
override
1035 m_inner->add_note (std::move (pn));
1032 void add_note (std::unique_ptr<pending_note> pn)
override {
…}
1037 void add_event (std::unique_ptr<checker_event> event)
override;
1042 m_inner->on_svalue_leak (sval);
1049 m_inner->on_liveness_change (live_svalues, model);
1055 return m_inner->get_logger ();
1062 const svalue *rhs)
override
1065 m_inner->on_condition (lhs, op, rhs);
1072 m_inner->on_bounded_ranges (sval, ranges);
1078 m_inner->on_pop_frame (frame_reg);
1084 m_inner->on_unknown_change (sval, is_mutable);
1097 m_inner->on_unexpected_tree_code (t, loc);
1103 m_inner->on_escaped_function (fndecl);
1109 return m_inner->get_uncertainty ();
1117 m_inner->purge_state_involving (sval);
1120 void bifurcate (std::unique_ptr<custom_edge_info> info)
override
1123 m_inner->bifurcate (std::move (info));
1120 void bifurcate (std::unique_ptr<custom_edge_info> info)
override {
…}
1135 return m_inner->get_ext_state ();
1143 unsigned *out_sm_idx,
1144 std::unique_ptr<sm_context> *out_sm_context)
1148 return m_inner->get_state_map_by_name (name, out_smap, out_sm, out_sm_idx,
1179 return m_inner->checking_for_infinite_loop_p ();
1185 m_inner->on_unusable_in_infinite_loop ();
1203 bool warn (std::unique_ptr<pending_diagnostic> d,
1207 if (
m_inner->warn (std::move (d), custom_finder))
1203 bool warn (std::unique_ptr<pending_diagnostic> d, {
…}
1246 void dump (FILE *fp,
bool simple)
const;
1257 return m_point.get_function_point ();
1345 return m_mgr.get_known_function_manager ();
1373 bool warn (std::unique_ptr<pending_diagnostic> d,
1376 m_diagnostics.safe_push (d.release ());
1380 unsigned get_num_diagnostics ()
const {
return m_diagnostics.length (); }
1382 void on_unexpected_tree_code (
tree t,
const dump_location_t &)
1391 auto_delete_vec<pending_diagnostic> m_diagnostics;
1397#define ADD_SAT_CONSTRAINT(MODEL, LHS, OP, RHS) \
1398 SELFTEST_BEGIN_STMT \
1399 bool sat = (MODEL).add_constraint (LHS, OP, RHS, NULL); \
1400 ASSERT_TRUE (sat); \
1406#define ADD_UNSAT_CONSTRAINT(MODEL, LHS, OP, RHS) \
1407 SELFTEST_BEGIN_STMT \
1408 bool sat = (MODEL).add_constraint (LHS, OP, RHS, NULL); \
1409 ASSERT_FALSE (sat); \
1414void assert_condition (
const location &loc,
1415 region_model &model,
1416 const svalue *lhs,
tree_code op,
const svalue *rhs,
1419void assert_condition (
const location &loc,
1420 region_model &model,
1427#define ASSERT_CONDITION_TRUE(REGION_MODEL, LHS, OP, RHS) \
1428 SELFTEST_BEGIN_STMT \
1429 assert_condition (SELFTEST_LOCATION, REGION_MODEL, LHS, OP, RHS, \
1430 tristate (tristate::TS_TRUE)); \
1436#define ASSERT_CONDITION_FALSE(REGION_MODEL, LHS, OP, RHS) \
1437 SELFTEST_BEGIN_STMT \
1438 assert_condition (SELFTEST_LOCATION, REGION_MODEL, LHS, OP, RHS, \
1439 tristate (tristate::TS_FALSE)); \
1445#define ASSERT_CONDITION_UNKNOWN(REGION_MODEL, LHS, OP, RHS) \
1446 SELFTEST_BEGIN_STMT \
1447 assert_condition (SELFTEST_LOCATION, REGION_MODEL, LHS, OP, RHS, \
1448 tristate (tristate::TS_UNKNOWN)); \
hash_map< rdwr_access_hash, attr_access > rdwr_map
Definition attribs.h:402
virtual void add_annotations()=0
annotating_context(region_model_context *inner)
Definition region-model.h:1219
bool warn(std::unique_ptr< pending_diagnostic > d, const stmt_finder *custom_finder) override
Definition region-model.h:1203
Definition constraint-manager.h:181
Definition call-details.h:29
Definition call-summary.h:68
Definition supergraph.h:453
Definition supergraph.h:522
Definition constraint-manager.h:425
Definition supergraph.h:715
Definition supergraph.h:610
Definition supergraph.h:665
known_function_manager * get_known_function_manager()
Definition region-model.h:1343
const supergraph * get_supergraph()
Definition region-model.h:1341
const supergraph * m_sg
Definition region-model.h:1351
region_model_manager * get_model_manager()
Definition region-model.h:1342
engine(const supergraph *sg=NULL, logger *logger=NULL)
void log_stats(logger *logger) const
region_model_manager m_mgr
Definition region-model.h:1352
Definition exploded-graph.h:804
Definition exploded-graph.h:203
Definition program-state.h:31
Definition program-point.h:73
Definition known-function-manager.h:41
Definition analyzer-logging.h:34
Definition region-model.h:940
bool get_state_map_by_name(const char *, sm_state_map **, const state_machine **, unsigned *, std::unique_ptr< sm_context > *) override
Definition region-model.h:981
bool checking_for_infinite_loop_p() const override
Definition region-model.h:993
bool warn(std::unique_ptr< pending_diagnostic >, const stmt_finder *) override
Definition region-model.h:942
void maybe_did_work() override
Definition region-model.h:992
uncertainty_t * get_uncertainty() override
Definition region-model.h:972
void on_unexpected_tree_code(tree, const dump_location_t &) override
Definition region-model.h:968
void on_unknown_change(const svalue *sval, bool is_mutable) override
Definition region-model.h:960
void on_pop_frame(const frame_region *) override
Definition region-model.h:959
void on_phi(const gphi *phi, tree rhs) override
Definition region-model.h:964
void on_condition(const svalue *lhs, enum tree_code op, const svalue *rhs) override
Definition region-model.h:950
void add_event(std::unique_ptr< checker_event >) override
void on_liveness_change(const svalue_set &, const region_model *) override
Definition region-model.h:947
logger * get_logger() override
Definition region-model.h:949
void on_escaped_function(tree) override
Definition region-model.h:970
const exploded_graph * get_eg() const override
Definition region-model.h:991
const gimple * get_stmt() const override
Definition region-model.h:990
void on_unusable_in_infinite_loop() override
Definition region-model.h:994
void on_svalue_leak(const svalue *) override
Definition region-model.h:946
void add_note(std::unique_ptr< pending_note >) override
void purge_state_involving(const svalue *sval) override
Definition region-model.h:974
const extrinsic_state * get_ext_state() const override
Definition region-model.h:979
void terminate_path() override
void on_bounded_ranges(const svalue &, const bounded_ranges &) override
Definition region-model.h:955
void bifurcate(std::unique_ptr< custom_edge_info > info) override
void put(T src, T dst)
Definition region-model.h:81
void dump() const
Definition region-model.h:123
T get_dst_for_src(T src) const
Definition region-model.h:90
void dump_to_pp(pretty_printer *pp) const
Definition region-model.h:101
auto_vec< T > m_src_to_dst
Definition region-model.h:62
void update(T *) const
Definition region-model.h:135
one_way_id_map(int num_ids)
Definition region-model.h:70
Definition program-point.h:175
Definition program-state.h:221
Definition region-model-reachability.h:36
region_model_context * m_inner
Definition region-model.h:1194
const exploded_graph * get_eg() const override
Definition region-model.h:1162
void on_bounded_ranges(const svalue &sval, const bounded_ranges &ranges) override
Definition region-model.h:1068
void on_phi(const gphi *phi, tree rhs) override
Definition region-model.h:1087
void add_event(std::unique_ptr< checker_event > event) override
const extrinsic_state * get_ext_state() const override
Definition region-model.h:1132
void on_condition(const svalue *lhs, enum tree_code op, const svalue *rhs) override
Definition region-model.h:1060
const gimple * get_stmt() const override
Definition region-model.h:1154
void maybe_did_work() override
Definition region-model.h:1170
void on_pop_frame(const frame_region *frame_reg) override
Definition region-model.h:1075
uncertainty_t * get_uncertainty() override
Definition region-model.h:1106
void bifurcate(std::unique_ptr< custom_edge_info > info) override
Definition region-model.h:1120
void add_note(std::unique_ptr< pending_note > pn) override
Definition region-model.h:1032
void on_svalue_leak(const svalue *sval) override
Definition region-model.h:1039
bool checking_for_infinite_loop_p() const override
Definition region-model.h:1176
logger * get_logger() override
Definition region-model.h:1052
region_model_context_decorator(region_model_context *inner)
Definition region-model.h:1189
void purge_state_involving(const svalue *sval) override
Definition region-model.h:1114
void on_liveness_change(const svalue_set &live_svalues, const region_model *model) override
Definition region-model.h:1045
bool warn(std::unique_ptr< pending_diagnostic > d, const stmt_finder *custom_finder) override
Definition region-model.h:1023
void on_unexpected_tree_code(tree t, const dump_location_t &loc) override
Definition region-model.h:1093
void on_escaped_function(tree fndecl) override
Definition region-model.h:1100
void terminate_path() override
Definition region-model.h:1126
void on_unknown_change(const svalue *sval, bool is_mutable) override
Definition region-model.h:1081
void on_unusable_in_infinite_loop() override
Definition region-model.h:1182
bool get_state_map_by_name(const char *name, sm_state_map **out_smap, const state_machine **out_sm, unsigned *out_sm_idx, std::unique_ptr< sm_context > *out_sm_context) override
Definition region-model.h:1140
Definition region-model.h:815
virtual void on_bounded_ranges(const svalue &sval, const bounded_ranges &ranges)=0
virtual void bifurcate(std::unique_ptr< custom_edge_info > info)=0
virtual void purge_state_involving(const svalue *sval)=0
virtual void on_escaped_function(tree fndecl)=0
virtual bool warn(std::unique_ptr< pending_diagnostic > d, const stmt_finder *custom_finder=NULL)=0
bool get_malloc_map(sm_state_map **out_smap, const state_machine **out_sm, unsigned *out_sm_idx)
Definition region-model.h:911
virtual void on_pop_frame(const frame_region *)=0
virtual void on_liveness_change(const svalue_set &live_svalues, const region_model *model)=0
bool get_fd_map(sm_state_map **out_smap, const state_machine **out_sm, unsigned *out_sm_idx, std::unique_ptr< sm_context > *out_sm_context)
Definition region-model.h:903
virtual void add_note(std::unique_ptr< pending_note > pn)=0
virtual logger * get_logger()=0
virtual const extrinsic_state * get_ext_state() const =0
bool possibly_tainted_p(const svalue *sval)
virtual void on_unexpected_tree_code(tree t, const dump_location_t &loc)=0
virtual void on_phi(const gphi *phi, tree rhs)=0
bool get_taint_map(sm_state_map **out_smap, const state_machine **out_sm, unsigned *out_sm_idx)
Definition region-model.h:917
virtual void on_svalue_leak(const svalue *sval)=0
virtual void on_condition(const svalue *lhs, enum tree_code op, const svalue *rhs)=0
virtual void on_unusable_in_infinite_loop()=0
virtual const exploded_graph * get_eg() const =0
virtual void on_unknown_change(const svalue *sval, bool is_mutable)=0
virtual const gimple * get_stmt() const =0
virtual uncertainty_t * get_uncertainty()=0
virtual bool checking_for_infinite_loop_p() const =0
virtual void terminate_path()=0
virtual bool get_state_map_by_name(const char *name, sm_state_map **out_smap, const state_machine **out_sm, unsigned *out_sm_idx, std::unique_ptr< sm_context > *out_sm_context)=0
virtual void add_event(std::unique_ptr< checker_event > event)=0
virtual void maybe_did_work()=0
Definition region-model-manager.h:32
Definition region-model.h:298
path_var get_representative_path_var(const svalue *sval, svalue_set *visited, logger *logger) const
region_model(const region_model &other)
void impl_deallocation_call(const call_details &cd)
void update_for_phis(const supernode *snode, const cfg_superedge *last_cfg_superedge, region_model_context *ctxt)
void update_for_zero_return(const call_details &cd, bool unmergeable)
bool add_constraint(tree lhs, enum tree_code op, tree rhs, region_model_context *ctxt)
const builtin_known_function * get_builtin_kf(const gcall &call, region_model_context *ctxt=NULL) const
store * get_store()
Definition region-model.h:494
constraint_manager * get_constraints()
Definition region-model.h:489
void update_for_nonzero_return(const call_details &cd)
bool add_constraint(tree lhs, enum tree_code op, tree rhs, region_model_context *ctxt, std::unique_ptr< rejected_constraint > *out)
void dump(FILE *fp, bool simple, bool multiline) const
bool replay_call_summary(call_summary_replay &r, const region_model &summary)
bool apply_constraints_for_gcond(const cfg_superedge &edge, const gcond *cond_stmt, region_model_context *ctxt, std::unique_ptr< rejected_constraint > *out)
bool apply_constraints_for_gswitch(const switch_cfg_superedge &edge, const gswitch *switch_stmt, region_model_context *ctxt, std::unique_ptr< rejected_constraint > *out)
void check_region_size(const region *lhs_reg, const svalue *rhs_sval, region_model_context *ctxt) const
void zero_fill_region(const region *reg, region_model_context *ctxt)
void on_asm_stmt(const gasm *asm_stmt, region_model_context *ctxt)
bool apply_constraints_for_eh_dispatch_allowed(const eh_dispatch_allowed_cfg_superedge &edge, region_model_context *ctxt, tree exception_type, std::unique_ptr< rejected_constraint > *out)
bool check_region_access(const region *reg, enum access_direction dir, const svalue *sval_hint, region_model_context *ctxt) const
bool can_merge_with_p(const region_model &other_model, const program_point &point, region_model *out_model, const extrinsic_state *ext_state=NULL, const program_state *state_a=NULL, const program_state *state_b=NULL) const
void update_for_return_gcall(const gcall &call_stmt, region_model_context *ctxt)
bool apply_constraints_for_eh_dispatch(const eh_dispatch_cfg_superedge &edge, const geh_dispatch *eh_dispatch_stmt, region_model_context *ctxt, std::unique_ptr< rejected_constraint > *out)
void update_for_gcall(const gcall &call_stmt, region_model_context *ctxt, function *callee=NULL)
bounded_ranges_manager * get_range_manager() const
Definition region-model.h:509
void dump(bool simple) const
path_var get_representative_path_var_1(const svalue *sval, svalue_set *visited, logger *logger) const
static void append_regions_cb(const region *base_reg, struct append_regions_cb_data *data)
const region * deref_rvalue(const svalue *ptr_sval, tree ptr_tree, region_model_context *ctxt, bool add_nonnull_constraint=true) const
void on_realloc_with_move(const call_details &cd, const svalue *old_ptr_sval, const svalue *new_ptr_sval)
constraint_manager * m_constraints
Definition region-model.h:792
const exception_node * get_current_thrown_exception() const
Definition region-model.h:627
const svalue * check_for_null_terminated_string_arg(const call_details &cd, unsigned idx) const
void set_errno(const call_details &cd)
void set_dynamic_extents(const region *reg, const svalue *size_in_bytes, region_model_context *ctxt)
void update_for_return_superedge(const return_superedge &return_edge, region_model_context *ctxt)
void check_region_for_write(const region *dest_reg, const svalue *sval_hint, region_model_context *ctxt) const
const svalue * get_dynamic_extents(const region *reg) const
void clobber_region(const region *reg)
void dump_to_pp(pretty_printer *pp, bool simple, bool multiline) const
void transition_ptr_sval_non_null(region_model_context *ctxt, const svalue *new_ptr_sval)
const svalue * get_rvalue_1(path_var pv, region_model_context *ctxt) const
tristate eval_condition(const svalue *lhs, enum tree_code op, const svalue *rhs) const
const svalue * check_for_null_terminated_string_arg(const call_details &cd, unsigned idx, bool include_terminator, const svalue **out_sval) const
void mark_as_tainted(const svalue *sval, region_model_context *ctxt)
const svalue * get_capacity(const region *reg) const
bool add_constraint(const svalue *lhs, enum tree_code op, const svalue *rhs, region_model_context *ctxt)
void on_assignment(const gassign *stmt, region_model_context *ctxt)
tristate symbolic_greater_than(const binop_svalue *a, const svalue *b) const
region_model & operator=(const region_model &other)
const frame_region * get_frame_at_index(int index) const
store m_store
Definition region-model.h:790
void print(pretty_printer *pp) const
const region * create_region_for_alloca(const svalue *size_in_bytes, region_model_context *ctxt)
void purge_region(const region *reg)
const region * push_frame(const function &fun, const gcall *call_stmt, const vec< const svalue * > *arg_sids, region_model_context *ctxt)
bool operator!=(const region_model &other) const
Definition region-model.h:308
const svalue * get_store_value(const region *reg, region_model_context *ctxt) const
const region * get_region_for_poisoned_expr(tree expr) const
void push_caught_exception(const exception_node &node)
Definition region-model.h:641
void check_function_attrs(const gcall &call, tree callee_fndecl, region_model_context *ctxt)
void get_regions_for_current_frame(auto_vec< const decl_region * > *out) const
std::unique_ptr< text_art::tree_widget > make_dump_widget(const text_art::dump_widget_info &dwi) const
const svalue * get_rvalue_for_bits(tree type, const region *reg, const bit_range &bits, region_model_context *ctxt) const
const svalue * get_initial_value_for_global(const region *reg) const
std::vector< exception_node > m_caught_exceptions_stack
Definition region-model.h:797
tristate compare_initial_and_pointer(const initial_svalue *init, const region_svalue *ptr) const
exception_node pop_thrown_exception()
Definition region-model.h:633
const function * get_current_function() const
const svalue * get_store_bytes(const region *base_reg, const byte_range &bytes, region_model_context *ctxt) const
static void register_pop_frame_callback(const pop_frame_callback &callback)
Definition region-model.h:606
bool apply_constraints_for_ggoto(const cfg_superedge &edge, const ggoto *goto_stmt, region_model_context *ctxt)
bool on_call_pre(const gcall &stmt, region_model_context *ctxt)
void loop_replay_fixup(const region_model *dst_state)
void check_dynamic_size_for_floats(const svalue *size_in_bytes, region_model_context *ctxt) const
bool operator==(const region_model &other) const
tree get_fndecl_for_call(const gcall &call, region_model_context *ctxt)
bool region_exists_p(const region *reg) const
tree get_representative_tree(const svalue *sval, logger *logger=nullptr) const
void check_function_attr_access(const gcall &call, tree callee_fndecl, region_model_context *ctxt, rdwr_map &rdwr_idx) const
region_model(region_model_manager *mgr)
void handle_unrecognized_call(const gcall &call, region_model_context *ctxt)
void push_thrown_exception(const exception_node &node)
Definition region-model.h:623
const svalue * maybe_get_copy_bounds(const region *src_reg, const svalue *num_bytes_sval)
region_to_value_map dynamic_extents_t
Definition region-model.h:300
bool apply_constraints_for_eh_dispatch_try(const eh_dispatch_try_cfg_superedge &edge, region_model_context *ctxt, tree exception_type, std::unique_ptr< rejected_constraint > *out)
tristate eval_condition(tree lhs, enum tree_code op, tree rhs, region_model_context *ctxt) const
const svalue * scan_for_null_terminator_1(const region *reg, tree expr, const svalue **out_sval, region_model_context *ctxt) const
bool called_from_main_p() const
bool add_constraints_from_binop(const svalue *outer_lhs, enum tree_code outer_op, const svalue *outer_rhs, bool *out, region_model_context *ctxt)
void check_one_function_attr_null_terminated_string_arg(const gcall &call, tree callee_fndecl, region_model_context *ctxt, rdwr_map &rdwr_idx, tree attr)
void set_value(const region *lhs_reg, const svalue *rhs_sval, region_model_context *ctxt)
void on_return(const greturn *stmt, region_model_context *ctxt)
void get_reachable_svalues(svalue_set *out, const svalue *extra_sval, const uncertainty_t *uncertainty)
void update_for_call_superedge(const call_superedge &call_edge, region_model_context *ctxt)
tristate structural_equality(const svalue *a, const svalue *b) const
void copy_bytes(const region *dest_reg, const region *src_reg, tree src_ptr_expr, const svalue *num_bytes_sval, region_model_context *ctxt)
const frame_region * get_current_frame() const
Definition region-model.h:398
std::unique_ptr< json::object > to_json() const
region_model_manager *const m_mgr
Definition region-model.h:788
const frame_region * m_current_frame
Definition region-model.h:794
void check_region_for_taint(const region *reg, enum access_direction dir, region_model_context *ctxt) const
void on_top_level_param(tree param, bool nonnull, region_model_context *ctxt)
bool maybe_update_for_edge(const superedge &edge, const gimple *last_stmt, region_model_context *ctxt, std::unique_ptr< rejected_constraint > *out)
void check_function_attr_null_terminated_string_arg(const gcall &call, tree callee_fndecl, region_model_context *ctxt, rdwr_map &rdwr_idx)
void mark_region_as_unknown(const region *reg, uncertainty_t *uncertainty)
void on_stmt_pre(const gimple *stmt, bool *out_unknown_side_effects, region_model_context *ctxt)
void check_call_format_attr(const call_details &cd, tree format_attr) const
void check_for_throw_inside_call(const gcall &call, tree fndecl, region_model_context *ctxt)
void set_value(tree lhs, tree rhs, region_model_context *ctxt)
bool check_region_for_read(const region *src_reg, region_model_context *ctxt) const
void maybe_complain_about_infoleak(const region *dst_reg, const svalue *copied_sval, const region *src_reg, region_model_context *ctxt)
region_model_manager * get_manager() const
Definition region-model.h:508
const known_function * get_known_function(tree fndecl, const call_details &cd) const
void handle_phi(const gphi *phi, tree lhs, tree rhs, const region_model &old_state, hash_set< const svalue * > &svals_changing_meaning, region_model_context *ctxt)
const exception_node * get_current_caught_exception() const
Definition region-model.h:645
void write_bytes(const region *dest_reg, const svalue *num_bytes_sval, const svalue *sval, region_model_context *ctxt)
void on_longjmp(const gcall &longjmp_call, const gcall &setjmp_call, int setjmp_stack_depth, region_model_context *ctxt)
void unset_dynamic_extents(const region *reg)
void check_for_writable_region(const region *dest_reg, region_model_context *ctxt) const
const region * get_lvalue_1(path_var pv, region_model_context *ctxt) const
const known_function * get_known_function(enum internal_fn) const
path_var get_representative_path_var(const region *reg, svalue_set *visited, logger *logger) const
const region * get_lvalue(path_var pv, region_model_context *ctxt) const
void get_referenced_base_regions(auto_bitmap &out_ids) const
void update_for_int_cst_return(const call_details &cd, int retval, bool unmergeable)
const svalue * check_for_poison(const svalue *sval, tree expr, const region *src_region, region_model_context *ctxt) const
int get_stack_depth() const
std::vector< exception_node > m_thrown_exceptions_stack
Definition region-model.h:796
bool check_region_bounds(const region *reg, enum access_direction dir, const svalue *sval_hint, region_model_context *ctxt) const
tree get_representative_tree(const region *reg, logger *logger=nullptr) const
void on_call_post(const gcall &stmt, bool unknown_side_effects, region_model_context *ctxt)
void check_call_args(const call_details &cd) const
void fill_region(const region *reg, const svalue *sval, region_model_context *ctxt)
void check_dynamic_size_for_taint(enum memory_space mem_space, const svalue *size_in_bytes, region_model_context *ctxt) const
bool check_symbolic_bounds(const region *base_reg, const svalue *sym_byte_offset, const svalue *num_bytes_sval, const svalue *capacity, enum access_direction dir, const svalue *sval_hint, region_model_context *ctxt) const
void mark_as_valid_fd(const svalue *sval, region_model_context *ctxt)
const svalue * get_rvalue(path_var pv, region_model_context *ctxt) const
path_var get_representative_path_var_1(const region *reg, svalue_set *visited, logger *logger) const
const store * get_store() const
Definition region-model.h:495
static void notify_on_pop_frame(const region_model *model, const region_model *prev_model, const svalue *retval, region_model_context *ctxt)
Definition region-model.h:612
dynamic_extents_t m_dynamic_extents
Definition region-model.h:803
static auto_vec< pop_frame_callback > pop_frame_callbacks
Definition region-model.h:786
int poison_any_pointers_to_descendents(const region *reg, enum poison_kind pkind)
const region * get_lvalue(tree expr, region_model_context *ctxt) const
const svalue * get_gassign_result(const gassign *assign, region_model_context *ctxt)
const svalue * read_bytes(const region *src_reg, tree src_ptr_expr, const svalue *num_bytes_sval, region_model_context *ctxt) const
void pop_frame(tree result_lvalue, const svalue **out_result, region_model_context *ctxt, const gcall *call_stmt, bool eval_return_svalue=true)
const svalue * scan_for_null_terminator(const region *reg, tree expr, const svalue **out_sval, region_model_context *ctxt) const
const region * get_or_create_region_for_heap_alloc(const svalue *size_in_bytes, region_model_context *ctxt, bool update_state_machine=false, const call_details *cd=nullptr)
exception_node pop_caught_exception()
Definition region-model.h:651
const svalue * get_rvalue(tree expr, region_model_context *ctxt) const
bool canonicalized_p() const
void purge_state_involving(const svalue *sval, region_model_context *ctxt)
void on_setjmp(const gcall &stmt, const exploded_node *enode, region_model_context *ctxt)
void unbind_region_and_descendents(const region *reg, enum poison_kind pkind)
const dynamic_extents_t & get_dynamic_extents() const
Definition region-model.h:498
Definition region-model.h:143
void remove(const region *reg)
Definition region-model.h:170
iterator begin() const
Definition region-model.h:159
const svalue *const * get(const region *reg) const
Definition region-model.h:162
hash_map_t::iterator iterator
Definition region-model.h:146
hash_map_t m_hash_map
Definition region-model.h:191
std::unique_ptr< text_art::tree_widget > make_dump_widget(const text_art::dump_widget_info &dwi) const
void purge_state_involving(const svalue *sval)
std::unique_ptr< json::object > to_json() const
hash_map< const region *, const svalue * > hash_map_t
Definition region-model.h:145
bool operator==(const region_to_value_map &other) const
iterator end() const
Definition region-model.h:160
void put(const region *reg, const svalue *sval)
Definition region-model.h:166
bool is_empty() const
Definition region-model.h:175
region_to_value_map & operator=(const region_to_value_map &other)
region_to_value_map()
Definition region-model.h:148
void dump_to_pp(pretty_printer *pp, bool simple, bool multiline) const
bool operator!=(const region_to_value_map &other) const
Definition region-model.h:154
void dump(bool simple) const
bool can_merge_with_p(const region_to_value_map &other, region_to_value_map *out) const
region_to_value_map(const region_to_value_map &other)
Definition region-model.h:149
virtual ~rejected_constraint()
Definition region-model.h:1280
virtual void dump_to_pp(pretty_printer *pp) const =0
rejected_constraint(const region_model &model)
Definition region-model.h:1286
const region_model & get_model() const
Definition region-model.h:1283
region_model m_model
Definition region-model.h:1290
void dump_to_pp(pretty_printer *pp) const final override
rejected_default_case(const region_model &model)
Definition region-model.h:1312
tree m_rhs
Definition region-model.h:1306
rejected_op_constraint(const region_model &model, tree lhs, enum tree_code op, tree rhs)
Definition region-model.h:1296
tree m_lhs
Definition region-model.h:1304
void dump_to_pp(pretty_printer *pp) const final override
enum tree_code m_op
Definition region-model.h:1305
void dump_to_pp(pretty_printer *pp) const final override
tree m_expr
Definition region-model.h:1331
const bounded_ranges * m_ranges
Definition region-model.h:1332
rejected_ranges_constraint(const region_model &model, tree expr, const bounded_ranges *ranges)
Definition region-model.h:1322
Definition supergraph.h:489
Definition program-state.h:89
Definition exploded-graph.h:1051
Definition supergraph.h:318
Definition supergraph.h:113
Definition supergraph.h:239
Definition supergraph.h:564
int m_num_unexpected_codes
Definition region-model.h:1014
bool had_errors_p() const
Definition region-model.h:1011
void on_unexpected_tree_code(tree, const dump_location_t &) final override
Definition region-model.h:1005
tentative_region_model_context()
Definition region-model.h:1003
Definition region-model.h:222
virtual void visit_unknown_svalue(const unknown_svalue *)
Definition region-model.h:226
virtual void visit_poisoned_svalue(const poisoned_svalue *)
Definition region-model.h:227
virtual void visit_asm_output_svalue(const asm_output_svalue *)
Definition region-model.h:240
virtual void visit_unaryop_svalue(const unaryop_svalue *)
Definition region-model.h:230
virtual void visit_region_svalue(const region_svalue *)
Definition region-model.h:224
virtual void visit_initial_svalue(const initial_svalue *)
Definition region-model.h:229
virtual void visit_sub_svalue(const sub_svalue *)
Definition region-model.h:232
virtual void visit_setjmp_svalue(const setjmp_svalue *)
Definition region-model.h:228
virtual void visit_conjured_svalue(const conjured_svalue *)
Definition region-model.h:239
virtual void visit_placeholder_svalue(const placeholder_svalue *)
Definition region-model.h:236
virtual void visit_binop_svalue(const binop_svalue *)
Definition region-model.h:231
virtual void visit_const_fn_result_svalue(const const_fn_result_svalue *)
Definition region-model.h:241
virtual void visit_compound_svalue(const compound_svalue *)
Definition region-model.h:238
virtual void visit_unmergeable_svalue(const unmergeable_svalue *)
Definition region-model.h:235
virtual void visit_widening_svalue(const widening_svalue *)
Definition region-model.h:237
virtual void visit_bits_within_svalue(const bits_within_svalue *)
Definition region-model.h:234
virtual void visit_constant_svalue(const constant_svalue *)
Definition region-model.h:225
virtual void visit_region(const region *)
Definition region-model.h:243
virtual void visit_repeated_svalue(const repeated_svalue *)
Definition region-model.h:233
Definition genoutput.cc:150
Definition dumpfile.h:446
Definition genmatch.cc:1506
Definition pretty-print.h:241
void set_output_stream(FILE *outfile)
Definition pretty-print.h:274
class edge_def * edge
Definition coretypes.h:352
union tree_node * tree
Definition coretypes.h:97
void internal_error(const char *,...) ATTRIBUTE_GCC_DIAG(1
internal_fn
Definition genmatch.cc:1015
tree_code
Definition genmatch.cc:1002
Definition access-diagram.h:30
@ stmt
Definition checker-event.h:37
@ return_edge
Definition checker-event.h:45
@ debug
Definition checker-event.h:35
@ call_edge
Definition checker-event.h:44
access_direction
Definition common.h:369
poison_kind
Definition svalue.h:427
void(* pop_frame_callback)(const region_model *model, const region_model *prev_model, const svalue *retval, region_model_context *ctxt)
Definition region-model.h:248
hash_set< const svalue * > svalue_set
Definition common.h:78
memory_space
Definition region.h:32
Definition fold-const.cc:4338
void add_path_var(path_var pv, hash &hstate)
Definition dump-context.h:31
poly_int< N, C > r
Definition poly-int.h:774
i
Definition poly-int.h:776
Ca const poly_int< N, Cb > & b
Definition poly-int.h:771
Ca & a
Definition poly-int.h:770
void pp_flush(pretty_printer *pp)
Definition pretty-print.cc:2348
void pp_newline(pretty_printer *pp)
Definition pretty-print.cc:2625
void pp_string(pretty_printer *pp, const char *str)
Definition pretty-print.cc:2652
Definition constraint-manager.h:123
Definition region-model.h:257
exception_node(const svalue *exception_sval, const svalue *typeinfo_sval, const svalue *destructor_sval)
Definition region-model.h:258
const svalue * m_exception_sval
Definition region-model.h:283
bool operator==(const exception_node &other) const
tree maybe_get_type() const
void dump(bool simple) const
const svalue * m_typeinfo_sval
Definition region-model.h:284
const svalue * m_destructor_sval
Definition region-model.h:285
void dump(FILE *fp, bool simple) const
std::unique_ptr< text_art::tree_widget > make_dump_widget(const text_art::dump_widget_info &dwi) const
void dump_to_pp(pretty_printer *pp, bool simple) const
std::unique_ptr< json::object > to_json() const
void add_to_reachable_regions(reachable_regions &) const
const program_point & m_point
Definition region-model.h:1264
const program_state * m_state_a
Definition region-model.h:1268
const region_model * m_model_a
Definition region-model.h:1262
const extrinsic_state * m_ext_state
Definition region-model.h:1267
hash_set< const svalue * > m_svals_changing_meaning
Definition region-model.h:1271
void dump_to_pp(pretty_printer *pp, bool simple) const
model_merger(const region_model *model_a, const region_model *model_b, const program_point &point, region_model *merged_model, const extrinsic_state *ext_state, const program_state *state_a, const program_state *state_b)
Definition region-model.h:1230
const program_state * m_state_b
Definition region-model.h:1269
bool mergeable_svalue_p(const svalue *) const
void dump(bool simple) const
region_model_manager * get_manager() const
Definition region-model.h:1249
void on_widening_reuse(const widening_svalue *widening_sval)
region_model * m_merged_model
Definition region-model.h:1265
void dump(FILE *fp, bool simple) const
const function_point & get_function_point() const
Definition region-model.h:1255
const region_model * m_model_b
Definition region-model.h:1263
int m_num_equiv_classes
Definition region-model.h:212
int m_num_bounded_ranges_constraints
Definition region-model.h:214
int m_num_client_items
Definition region-model.h:215
int m_num_svalues
Definition region-model.h:210
purge_stats()
Definition region-model.h:201
int m_num_constraints
Definition region-model.h:213
int m_num_regions
Definition region-model.h:211
Definition function.h:249
Definition gengtype.h:252
#define NULL
Definition system.h:50
#define gcc_assert(EXPR)
Definition system.h:814
#define DEBUG_FUNCTION
Definition system.h:1236
static bitmap visited
Definition tree-ssa-dce.cc:640
static control_dependences * cd
Definition tree-ssa-dce.cc:104
const char * get_tree_code_name(enum tree_code code)
Definition tree.cc:12895
#define TREE_CODE(NODE)
Definition tree.h:324
tree size_in_bytes(const_tree t)
Definition tree.h:5169
#define FOR_EACH_VEC_ELT(V, I, P)
Definition vec.h:1895