diff options
Diffstat (limited to 'gcc/analyzer/svalue.h')
-rw-r--r-- | gcc/analyzer/svalue.h | 73 |
1 files changed, 38 insertions, 35 deletions
diff --git a/gcc/analyzer/svalue.h b/gcc/analyzer/svalue.h index bf9e12b..0ccb5ce 100644 --- a/gcc/analyzer/svalue.h +++ b/gcc/analyzer/svalue.h @@ -112,37 +112,37 @@ public: const char *prefix = nullptr) const; virtual const region_svalue * - dyn_cast_region_svalue () const { return NULL; } + dyn_cast_region_svalue () const { return nullptr; } virtual const constant_svalue * - dyn_cast_constant_svalue () const { return NULL; } + dyn_cast_constant_svalue () const { return nullptr; } virtual const poisoned_svalue * - dyn_cast_poisoned_svalue () const { return NULL; } + dyn_cast_poisoned_svalue () const { return nullptr; } virtual const setjmp_svalue * - dyn_cast_setjmp_svalue () const { return NULL; } + dyn_cast_setjmp_svalue () const { return nullptr; } virtual const initial_svalue * - dyn_cast_initial_svalue () const { return NULL; } + dyn_cast_initial_svalue () const { return nullptr; } virtual const unaryop_svalue * - dyn_cast_unaryop_svalue () const { return NULL; } + dyn_cast_unaryop_svalue () const { return nullptr; } virtual const binop_svalue * - dyn_cast_binop_svalue () const { return NULL; } + dyn_cast_binop_svalue () const { return nullptr; } virtual const sub_svalue * - dyn_cast_sub_svalue () const { return NULL; } + dyn_cast_sub_svalue () const { return nullptr; } virtual const repeated_svalue * - dyn_cast_repeated_svalue () const { return NULL; } + dyn_cast_repeated_svalue () const { return nullptr; } virtual const bits_within_svalue * - dyn_cast_bits_within_svalue () const { return NULL; } + dyn_cast_bits_within_svalue () const { return nullptr; } virtual const unmergeable_svalue * - dyn_cast_unmergeable_svalue () const { return NULL; } + dyn_cast_unmergeable_svalue () const { return nullptr; } virtual const widening_svalue * - dyn_cast_widening_svalue () const { return NULL; } + dyn_cast_widening_svalue () const { return nullptr; } virtual const compound_svalue * - dyn_cast_compound_svalue () const { return NULL; } + dyn_cast_compound_svalue () const { return nullptr; } virtual const conjured_svalue * - dyn_cast_conjured_svalue () const { return NULL; } + dyn_cast_conjured_svalue () const { return nullptr; } virtual const asm_output_svalue * - dyn_cast_asm_output_svalue () const { return NULL; } + dyn_cast_asm_output_svalue () const { return nullptr; } virtual const const_fn_result_svalue * - dyn_cast_const_fn_result_svalue () const { return NULL; } + dyn_cast_const_fn_result_svalue () const { return nullptr; } tree maybe_get_constant () const; const region *maybe_get_region () const; @@ -188,6 +188,8 @@ public: const region_model &model, const svalue *outer_sval = nullptr) const; + tree maybe_get_type_from_typeinfo () const; + protected: svalue (complexity c, symbol::id_t id, tree type) : symbol (c, id), m_type (type) @@ -244,7 +246,7 @@ public: : svalue (complexity (reg), id, type), m_reg (reg) { - gcc_assert (m_reg != NULL); + gcc_assert (m_reg != nullptr); } enum svalue_kind get_kind () const final override { return SK_REGION; } @@ -421,19 +423,19 @@ public: /* An enum describing a particular kind of "poisoned" value. */ -enum poison_kind +enum class poison_kind { /* For use to describe uninitialized memory. */ - POISON_KIND_UNINIT, + uninit, /* For use to describe freed memory. */ - POISON_KIND_FREED, + freed, /* For use to describe deleted memory. */ - POISON_KIND_DELETED, + deleted, /* For use on pointers to regions within popped stack frames. */ - POISON_KIND_POPPED_STACK + popped_stack }; extern const char *poison_kind_to_str (enum poison_kind); @@ -454,7 +456,7 @@ public: hashval_t hash () const { inchash::hash hstate; - hstate.add_int (m_kind); + hstate.add_int (static_cast<int> (m_kind)); hstate.add_ptr (m_type); return hstate.end (); } @@ -528,8 +530,8 @@ namespace ana { struct setjmp_record { setjmp_record (const exploded_node *enode, - const gcall *setjmp_call) - : m_enode (enode), m_setjmp_call (setjmp_call) + const gcall &setjmp_call) + : m_enode (enode), m_setjmp_call (&setjmp_call) { } @@ -549,6 +551,7 @@ struct setjmp_record const exploded_node *m_enode; const gcall *m_setjmp_call; + // non-null, but we can't use a reference since we're putting these in a hash_map }; /* Concrete subclass of svalue representing buffers for setjmp/sigsetjmp, @@ -647,7 +650,7 @@ public: initial_svalue (symbol::id_t id, tree type, const region *reg) : svalue (complexity (reg), id, type), m_reg (reg) { - gcc_assert (m_reg != NULL); + gcc_assert (m_reg != nullptr); } enum svalue_kind get_kind () const final override { return SK_INITIAL; } @@ -1544,15 +1547,15 @@ public: && m_idx == other.m_idx); } - /* Use m_stmt to mark empty/deleted, as m_type can be NULL for + /* Use m_stmt to mark empty/deleted, as m_type can be NULL_TREE for legitimate instances. */ void mark_deleted () { m_stmt = reinterpret_cast<const gimple *> (1); } - void mark_empty () { m_stmt = NULL; } + void mark_empty () { m_stmt = nullptr; } bool is_deleted () const { return m_stmt == reinterpret_cast<const gimple *> (1); } - bool is_empty () const { return m_stmt == NULL; } + bool is_empty () const { return m_stmt == nullptr; } tree m_type; const gimple *m_stmt; @@ -1565,7 +1568,7 @@ public: : svalue (complexity (id_reg), id, type), m_stmt (stmt), m_id_reg (id_reg), m_idx (idx) { - gcc_assert (m_stmt != NULL); + gcc_assert (m_stmt != nullptr); } enum svalue_kind get_kind () const final override { return SK_CONJURED; } @@ -1665,15 +1668,15 @@ public: return true; } - /* Use m_asm_string to mark empty/deleted, as m_type can be NULL for + /* Use m_asm_string to mark empty/deleted, as m_type can be NULL_TREE for legitimate instances. */ void mark_deleted () { m_asm_string = reinterpret_cast<const char *> (1); } - void mark_empty () { m_asm_string = NULL; } + void mark_empty () { m_asm_string = nullptr; } bool is_deleted () const { return m_asm_string == reinterpret_cast<const char *> (1); } - bool is_empty () const { return m_asm_string == NULL; } + bool is_empty () const { return m_asm_string == nullptr; } tree m_type; const char *m_asm_string; @@ -1810,12 +1813,12 @@ public: /* Use m_fndecl to mark empty/deleted. */ void mark_deleted () { m_fndecl = reinterpret_cast<tree> (1); } - void mark_empty () { m_fndecl = NULL; } + void mark_empty () { m_fndecl = NULL_TREE; } bool is_deleted () const { return m_fndecl == reinterpret_cast<tree> (1); } - bool is_empty () const { return m_fndecl == NULL; } + bool is_empty () const { return m_fndecl == NULL_TREE; } tree m_type; tree m_fndecl; |