if (!wi::fits_uhwi_p (concrete_num_bytes))
return nullptr;
if (concrete_num_bytes == 1)
- return ::make_unique <text_art::styled_string>
+ return std::make_unique <text_art::styled_string>
(fmt_styled_string (sm, concrete_single_byte_fmt,
concrete_num_bytes.to_uhwi ()));
else
- return ::make_unique <text_art::styled_string>
+ return std::make_unique <text_art::styled_string>
(fmt_styled_string (sm, concrete_plural_bytes_fmt,
concrete_num_bytes.to_uhwi ()));
}
pp_format_decoder (&pp) = default_tree_printer;
if (!num_bytes->maybe_print_for_user (&pp, model))
return nullptr;
- return ::make_unique <text_art::styled_string>
+ return std::make_unique <text_art::styled_string>
(fmt_styled_string (sm, symbolic_bytes_fmt,
pp_formatted_text (&pp)));
}
if (!wi::fits_uhwi_p (concrete_num_bits))
return nullptr;
if (concrete_num_bits == 1)
- return ::make_unique <text_art::styled_string>
+ return std::make_unique <text_art::styled_string>
(fmt_styled_string (sm, concrete_single_bit_fmt,
concrete_num_bits.to_uhwi ()));
else
- return ::make_unique <text_art::styled_string>
+ return std::make_unique <text_art::styled_string>
(fmt_styled_string (sm, concrete_plural_bits_fmt,
concrete_num_bits.to_uhwi ()));
}
pp_format_decoder (&pp) = default_tree_printer;
if (!m_num_bits.maybe_print_for_user (&pp, model))
return nullptr;
- return ::make_unique <text_art::styled_string>
+ return std::make_unique <text_art::styled_string>
(fmt_styled_string (sm, symbolic_bits_fmt,
pp_formatted_text (&pp)));
}
if (const initial_svalue *initial_sval = sval.dyn_cast_initial_svalue ())
if (const string_region *string_reg
= initial_sval->get_region ()->dyn_cast_string_region ())
- return make_unique <string_literal_spatial_item>
+ return std::make_unique <string_literal_spatial_item>
(sval, actual_bits,
*string_reg, theme,
svalue_spatial_item::kind::WRITTEN);
- return make_unique <written_svalue_spatial_item> (op, sval, actual_bits);
+ return std::make_unique <written_svalue_spatial_item> (op, sval, actual_bits);
}
static std::unique_ptr<spatial_item>
const initial_svalue *initial_sval = (const initial_svalue *)sval;
if (const string_region *string_reg
= initial_sval->get_region ()->dyn_cast_string_region ())
- return make_unique <string_literal_spatial_item>
+ return std::make_unique <string_literal_spatial_item>
(*sval, bits,
*string_reg, theme,
svalue_spatial_item::kind::EXISTING);
}
case SK_COMPOUND:
- return make_unique<compound_svalue_spatial_item>
+ return std::make_unique<compound_svalue_spatial_item>
(*((const compound_svalue *)sval),
bits,
svalue_spatial_item::kind::EXISTING,
}
m_col_widths
- = make_unique <table_dimension_sizes> (m_btm.get_num_columns ());
+ = std::make_unique <table_dimension_sizes> (m_btm.get_num_columns ());
/* Now create child widgets. */
std::unique_ptr<boundaries>
find_boundaries () const
{
- std::unique_ptr<boundaries> result
- = make_unique<boundaries> (*m_op.m_base_region, m_logger);
+ auto result
+ = std::make_unique<boundaries> (*m_op.m_base_region, m_logger);
m_valid_region_spatial_item.add_boundaries (*result, m_logger);
m_accessed_region_spatial_item.add_boundaries (*result, m_logger);
void add_direction_widget ()
{
- add_child (::make_unique<direction_widget> (*this, m_btm));
+ add_child (std::make_unique<direction_widget> (*this, m_btm));
}
void add_invalid_accesses_to_region_table (table &t_region)
style_manager &sm,
const theme &theme,
logger *logger)
-: wrapper_widget (make_unique <access_diagram_impl> (op,
- region_creation_event_id,
- sm,
- theme,
- logger))
+: wrapper_widget
+ (std::make_unique <access_diagram_impl> (op,
+ region_creation_event_id,
+ sm,
+ theme,
+ logger))
{
}
tree_to_json (tree node)
{
if (!node)
- return ::make_unique<json::literal> (json::JSON_NULL);
+ return std::make_unique<json::literal> (json::JSON_NULL);
pretty_printer pp;
dump_generic_node (&pp, node, 0, TDF_VOPS|TDF_MEMSYMS, false);
- return ::make_unique<json::string> (pp_formatted_text (&pp));
+ return std::make_unique<json::string> (pp_formatted_text (&pp));
}
/* Generate a JSON value for EVENT_ID.
{
pretty_printer pp;
pp_printf (&pp, "%@", &event_id);
- return ::make_unique<json::string> (pp_formatted_text (&pp));
+ return std::make_unique<json::string> (pp_formatted_text (&pp));
}
else
- return ::make_unique<json::literal> (json::JSON_NULL);
+ return std::make_unique<json::literal> (json::JSON_NULL);
}
/* Generate a JSON value for OFFSET.
{
pretty_printer pp;
pp_wide_int_large (&pp, offset, SIGNED);
- return ::make_unique<json::string> (pp_formatted_text (&pp));
+ return std::make_unique<json::string> (pp_formatted_text (&pp));
}
/* Generate a JSON value for OFFSET.
{
pretty_printer pp;
pp_wide_int_large (&pp, offset, SIGNED);
- return ::make_unique<json::string> (pp_formatted_text (&pp));
+ return std::make_unique<json::string> (pp_formatted_text (&pp));
}
/* Workaround for lack of const-correctness of ssa_default_def. */
so we don't need an event for that. */
if (byte_capacity)
emission_path.add_event
- (make_unique<oob_region_creation_event_capacity> (byte_capacity,
- loc_info,
- *this));
+ (std::make_unique<oob_region_creation_event_capacity> (byte_capacity,
+ loc_info,
+ *this));
}
void maybe_add_sarif_properties (sarif_object &result_obj)
{
if (m_byte_bound && TREE_CODE (m_byte_bound) == INTEGER_CST)
emission_path.add_event
- (make_unique<oob_region_creation_event_capacity> (m_byte_bound,
- loc_info,
- *this));
+ (std::make_unique<oob_region_creation_event_capacity> (m_byte_bound,
+ loc_info,
+ *this));
}
void maybe_add_sarif_properties (sarif_object &result_obj)
break;
case access_direction::read:
gcc_assert (sval_hint == nullptr);
- ctxt->warn (make_unique<symbolic_buffer_over_read> (*this,
- sized_offset_reg,
- diag_arg,
- offset_tree,
- num_bytes_tree,
- capacity_tree));
+ ctxt->warn
+ (std::make_unique<symbolic_buffer_over_read> (*this,
+ sized_offset_reg,
+ diag_arg,
+ offset_tree,
+ num_bytes_tree,
+ capacity_tree));
return false;
break;
case access_direction::write:
- ctxt->warn (make_unique<symbolic_buffer_overflow> (*this,
- sized_offset_reg,
- diag_arg,
- offset_tree,
- num_bytes_tree,
- capacity_tree,
- sval_hint));
+ ctxt->warn
+ (std::make_unique<symbolic_buffer_overflow> (*this,
+ sized_offset_reg,
+ diag_arg,
+ offset_tree,
+ num_bytes_tree,
+ capacity_tree,
+ sval_hint));
return false;
break;
}
break;
case access_direction::read:
gcc_assert (sval_hint == nullptr);
- ctxt->warn (make_unique<concrete_buffer_under_read> (*this, reg,
- diag_arg,
- bits_outside));
+ ctxt->warn
+ (std::make_unique<concrete_buffer_under_read> (*this, reg,
+ diag_arg,
+ bits_outside));
oob_safe = false;
break;
case access_direction::write:
- ctxt->warn (make_unique<concrete_buffer_underwrite> (*this,
- reg, diag_arg,
- bits_outside,
- sval_hint));
+ ctxt->warn
+ (std::make_unique<concrete_buffer_underwrite> (*this,
+ reg, diag_arg,
+ bits_outside,
+ sval_hint));
oob_safe = false;
break;
}
break;
case access_direction::read:
gcc_assert (sval_hint == nullptr);
- ctxt->warn (make_unique<concrete_buffer_over_read> (*this,
- reg, diag_arg,
- bits_outside,
- bit_bound));
+ ctxt->warn
+ (std::make_unique<concrete_buffer_over_read> (*this,
+ reg, diag_arg,
+ bits_outside,
+ bit_bound));
oob_safe = false;
break;
case access_direction::write:
- ctxt->warn (make_unique<concrete_buffer_overflow> (*this,
- reg, diag_arg,
- bits_outside,
- bit_bound,
- sval_hint));
+ ctxt->warn
+ (std::make_unique<concrete_buffer_overflow> (*this,
+ reg, diag_arg,
+ bits_outside,
+ bit_bound,
+ sval_hint));
oob_safe = false;
break;
}
if (!byte_range_a.intersection (byte_range_b, *model).is_true ())
return;
- ctxt->warn (make_unique<overlapping_buffers> (get_fndecl_for_call (),
- byte_range_a,
- byte_range_b,
- num_bytes_read_sval));
+ ctxt->warn (std::make_unique<overlapping_buffers> (get_fndecl_for_call (),
+ byte_range_a,
+ byte_range_b,
+ num_bytes_read_sval));
}
} // namespace ana
const int stack_depth = src_point.get_stack_depth ();
emission_path->add_event
- (make_unique<call_event> (event_loc_info (get_call_stmt ().location,
+ (std::make_unique<call_event> (event_loc_info (get_call_stmt ().location,
caller_fndecl,
stack_depth),
this));
std::unique_ptr<json::value>
call_string::to_json () const
{
- auto arr = ::make_unique<json::array> ();
+ auto arr = std::make_unique<json::array> ();
for (const call_string::element_t &e : m_elements)
{
- auto e_obj = ::make_unique<json::object> ();
+ auto e_obj = std::make_unique<json::object> ();
e_obj->set_integer ("src_snode_idx", e.m_callee->m_index);
e_obj->set_integer ("dst_snode_idx", e.m_caller->m_index);
e_obj->set_string ("funcname", function_name (e.m_caller->m_fun));
pd->add_region_creation_events (reg, capacity, loc_info, *this);
if (debug)
- add_event (make_unique<region_creation_event_debug> (reg, capacity,
- loc_info));
+ add_event (std::make_unique<region_creation_event_debug> (reg, capacity,
+ loc_info));
}
void
#define INCLUDE_VECTOR
#include "system.h"
#include "coretypes.h"
-#include "make-unique.h"
#include "tree.h"
#include "function.h"
#include "basic-block.h"
std::unique_ptr<json::object>
bounded_range::to_json () const
{
- auto range_obj = ::make_unique<json::object> ();
+ auto range_obj = std::make_unique<json::object> ();
set_json_attr (*range_obj, "lower", m_lower);
set_json_attr (*range_obj, "upper", m_upper);
return range_obj;
std::unique_ptr<json::value>
bounded_ranges::to_json () const
{
- auto arr_obj = ::make_unique<json::array> ();
+ auto arr_obj = std::make_unique<json::array> ();
for (unsigned i = 0; i < m_ranges.length (); ++i)
arr_obj->append (m_ranges[i].to_json ());
std::unique_ptr<json::object>
equiv_class::to_json () const
{
- auto ec_obj = ::make_unique<json::object> ();
+ auto ec_obj = std::make_unique<json::object> ();
- auto sval_arr = ::make_unique<json::array> ();
+ auto sval_arr = std::make_unique<json::array> ();
for (const svalue *sval : m_vars)
sval_arr->append (sval->to_json ());
ec_obj->set ("svals", std::move (sval_arr));
std::unique_ptr<json::object>
constraint::to_json () const
{
- auto con_obj = ::make_unique<json::object> ();
+ auto con_obj = std::make_unique<json::object> ();
con_obj->set_integer ("lhs", m_lhs.as_int ());
con_obj->set_string ("op", constraint_op_code (m_op));
std::unique_ptr<json::object>
bounded_ranges_constraint::to_json () const
{
- auto con_obj = ::make_unique<json::object> ();
+ auto con_obj = std::make_unique<json::object> ();
con_obj->set_integer ("ec", m_ec_id.as_int ());
con_obj->set ("ranges", m_ranges->to_json ());
std::unique_ptr<json::object>
constraint_manager::to_json () const
{
- auto cm_obj = ::make_unique<json::object> ();
+ auto cm_obj = std::make_unique<json::object> ();
/* Equivalence classes. */
{
- auto ec_arr = ::make_unique<json::array> ();
+ auto ec_arr = std::make_unique<json::array> ();
for (const equiv_class *ec : m_equiv_classes)
ec_arr->append (ec->to_json ());
cm_obj->set ("ecs", std::move (ec_arr));
/* Constraints. */
{
- auto con_arr = ::make_unique<json::array> ();
+ auto con_arr = std::make_unique<json::array> ();
for (const constraint &c : m_constraints)
con_arr->append (c.to_json ());
cm_obj->set ("constraints", std::move (con_arr));
/* m_bounded_ranges_constraints. */
{
- auto con_arr = ::make_unique<json::array> ();
+ auto con_arr = std::make_unique<json::array> ();
for (const auto &c : m_bounded_ranges_constraints)
con_arr->append (c.to_json ());
cm_obj->set ("bounded_ranges_constraints", std::move (con_arr));
logger->log ("trying to find shortest path ignoring feasibility");
gcc_assert (m_sep);
std::unique_ptr<exploded_path> epath
- = make_unique<exploded_path> (m_sep->get_shortest_path (enode));
+ = std::make_unique<exploded_path> (m_sep->get_shortest_path (enode));
if (epath->feasible_p (logger, out_problem, m_eg.get_engine (), &m_eg))
{
if (logger)
std::unique_ptr<json::object>
saved_diagnostic::to_json () const
{
- auto sd_obj = ::make_unique<json::object> ();
+ auto sd_obj = std::make_unique<json::object> ();
if (m_sm)
sd_obj->set_string ("sm", m_sm->get_name ());
props.set_integer (PROPERTY_PREFIX "idx", m_idx);
if (m_duplicates.length () > 0)
{
- auto duplicates_arr = ::make_unique<json::array> ();
+ auto duplicates_arr = std::make_unique<json::array> ();
for (auto iter : m_duplicates)
{
- auto sd_obj = ::make_unique<sarif_object> ();
+ auto sd_obj = std::make_unique<sarif_object> ();
iter->maybe_add_sarif_properties (*sd_obj);
duplicates_arr->append (std::move (sd_obj));
}
std::unique_ptr<json::object>
diagnostic_manager::to_json () const
{
- auto dm_obj = ::make_unique<json::object> ();
+ auto dm_obj = std::make_unique<json::object> ();
{
- auto sd_arr = ::make_unique<json::array> ();
+ auto sd_arr = std::make_unique<json::array> ();
int i;
saved_diagnostic *sd;
FOR_EACH_VEC_ELT (m_saved_diagnostics, i, sd)
int stack_depth = src_stack_depth;
m_emission_path->add_event
- (make_unique<state_change_event> (supernode,
- stmt,
- stack_depth,
- sm,
- nullptr,
- src_sm_val,
- dst_sm_val,
- nullptr,
- dst_state,
- src_node));
+ (std::make_unique<state_change_event> (supernode,
+ stmt,
+ stack_depth,
+ sm,
+ nullptr,
+ src_sm_val,
+ dst_sm_val,
+ nullptr,
+ dst_state,
+ src_node));
return false;
}
return false;
m_emission_path->add_event
- (make_unique<state_change_event> (supernode,
- stmt,
- stack_depth,
- sm,
- sval,
- src_sm_val,
- dst_sm_val,
- dst_origin_sval,
- dst_state,
- src_node));
+ (std::make_unique<state_change_event> (supernode,
+ stmt,
+ stack_depth,
+ sm,
+ sval,
+ src_sm_val,
+ dst_sm_val,
+ dst_origin_sval,
+ dst_state,
+ src_node));
return false;
}
int stack_depth = m_point->get_stack_depth ();
m_emission_path->add_event
- (make_unique<state_change_event> (supernode,
- m_stmt,
- stack_depth,
- m_sm,
- var_new_sval,
- from, to,
- nullptr,
- *m_new_state,
- nullptr));
+ (std::make_unique<state_change_event> (supernode,
+ m_stmt,
+ stack_depth,
+ m_sm,
+ var_new_sval,
+ from, to,
+ nullptr,
+ *m_new_state,
+ nullptr));
}
void set_next_state (const gimple *stmt,
int stack_depth = m_point->get_stack_depth ();
m_emission_path->add_event
- (make_unique<state_change_event> (supernode,
- m_stmt,
- stack_depth,
- m_sm,
- sval,
- from, to,
- nullptr,
- *m_new_state,
- nullptr));
+ (std::make_unique<state_change_event> (supernode,
+ m_stmt,
+ stack_depth,
+ m_sm,
+ sval,
+ from, to,
+ nullptr,
+ *m_new_state,
+ nullptr));
}
void warn (const supernode *, const gimple *,
const gcall *call = dyn_cast <const gcall *> (stmt);
if (call && is_setjmp_call_p (*call))
emission_path->add_event
- (make_unique<setjmp_event> (event_loc_info (stmt->location,
- dst_point.get_fndecl (),
- dst_stack_depth),
- dst_node,
- *call));
+ (std::make_unique<setjmp_event>
+ (event_loc_info (stmt->location,
+ dst_point.get_fndecl (),
+ dst_stack_depth),
+ dst_node,
+ *call));
else
emission_path->add_event
- (make_unique<statement_event> (stmt,
- dst_point.get_fndecl (),
- dst_stack_depth, dst_state));
+ (std::make_unique<statement_event> (stmt,
+ dst_point.get_fndecl (),
+ dst_stack_depth, dst_state));
/* Create state change events for assignment to NULL.
Iterate through the stmts in dst_enode, adding state change
" at this edge: ");
pb.get_feasibility_problem ()->dump_to_pp (&pp);
emission_path->add_event
- (make_unique<precanned_custom_event>
- (event_loc_info (dst_point.get_location (),
- dst_point.get_fndecl (),
- dst_stack_depth),
- pp_formatted_text (&pp)));
+ (std::make_unique<precanned_custom_event>
+ (event_loc_info (dst_point.get_location (),
+ dst_point.get_fndecl (),
+ dst_stack_depth),
+ pp_formatted_text (&pp)));
}
}
case SUPEREDGE_CFG_EDGE:
{
emission_path->add_event
- (make_unique<start_cfg_edge_event>
- (eedge,
- event_loc_info (last_stmt ? last_stmt->location : UNKNOWN_LOCATION,
- src_point.get_fndecl (),
- src_stack_depth)));
+ (std::make_unique<start_cfg_edge_event>
+ (eedge,
+ event_loc_info
+ (last_stmt ? last_stmt->location : UNKNOWN_LOCATION,
+ src_point.get_fndecl (),
+ src_stack_depth)));
emission_path->add_event
- (make_unique<end_cfg_edge_event>
- (eedge,
- event_loc_info (dst_point.get_supernode ()->get_start_location (),
- dst_point.get_fndecl (),
- dst_stack_depth)));
+ (std::make_unique<end_cfg_edge_event>
+ (eedge,
+ event_loc_info (dst_point.get_supernode ()->get_start_location (),
+ dst_point.get_fndecl (),
+ dst_stack_depth)));
}
break;
/* TODO: add a subclass for this, or generate events for the
summary. */
emission_path->add_event
- (make_unique<debug_event> (event_loc_info (last_stmt
- ? last_stmt->location
- : UNKNOWN_LOCATION,
- src_point.get_fndecl (),
- src_stack_depth),
- "call summary"));
+ (std::make_unique<debug_event>
+ (event_loc_info (last_stmt
+ ? last_stmt->location
+ : UNKNOWN_LOCATION,
+ src_point.get_fndecl (),
+ src_stack_depth),
+ "call summary"));
}
break;
const gcall &call_stmt = return_edge->get_call_stmt ();
emission_path->add_event
- (make_unique<return_event> (eedge,
- event_loc_info (call_stmt.location,
- dst_point.get_fndecl (),
- dst_stack_depth)));
+ (std::make_unique<return_event>
+ (eedge,
+ event_loc_info (call_stmt.location,
+ dst_point.get_fndecl (),
+ dst_stack_depth)));
}
break;
}
{
const sm_state_map *old_smap = m_old_state->m_checker_states[sm_idx];
*out_sm_context
- = make_unique<impl_sm_context> (*m_eg,
- sm_idx,
- *sm,
- m_enode_for_diag,
- m_old_state,
- m_new_state,
- old_smap,
- new_smap,
- m_path_ctxt,
- m_stmt_finder,
- false);
+ = std::make_unique<impl_sm_context> (*m_eg,
+ sm_idx,
+ *sm,
+ m_enode_for_diag,
+ m_old_state,
+ m_new_state,
+ old_smap,
+ new_smap,
+ m_path_ctxt,
+ m_stmt_finder,
+ false);
}
return true;
}
std::unique_ptr<stmt_finder> clone () const final override
{
- return make_unique<leak_stmt_finder> (m_eg, m_var);
+ return std::make_unique<leak_stmt_finder> (m_eg, m_var);
}
const gimple *find_stmt (const exploded_path &epath)
std::unique_ptr<json::object>
exploded_node::to_json (const extrinsic_state &ext_state) const
{
- auto enode_obj = ::make_unique<json::object> ();
+ auto enode_obj = std::make_unique<json::object> ();
enode_obj->set ("point", get_point ().to_json ());
enode_obj->set ("state", get_state ().to_json (ext_state));
call_summary_replay r (cd, called_fn, summary, ext_state);
if (path_ctxt)
- path_ctxt->bifurcate (make_unique<call_summary_edge_info> (cd,
- called_fn,
- summary,
- ext_state));
+ path_ctxt->bifurcate
+ (std::make_unique<call_summary_edge_info> (cd,
+ called_fn,
+ summary,
+ ext_state));
}
/* Verify that the setjmp's call_stack hasn't been popped. */
if (!valid_longjmp_stack_p (longjmp_point, setjmp_point))
{
- ctxt->warn (make_unique<stale_jmp_buf> (setjmp_call,
- longjmp_call,
- setjmp_point));
+ ctxt->warn (std::make_unique<stale_jmp_buf> (setjmp_call,
+ longjmp_call,
+ setjmp_point));
return;
}
{
exploded_edge *eedge
= eg.add_edge (const_cast<exploded_node *> (this), next, NULL, true,
- make_unique<rewind_info_t> (tmp_setjmp_record,
- longjmp_call));
+ std::make_unique<rewind_info_t> (tmp_setjmp_record,
+ longjmp_call));
/* For any diagnostics that were queued here (such as leaks) we want
the checker_path to show the rewinding events after the "final event"
if (m_is_returning_call)
emission_path->add_event
- (make_unique<return_event> (eedge,
- event_loc_info (m_dynamic_call.location,
- dest_point.get_fndecl (),
- dest_stack_depth)));
+ (std::make_unique<return_event> (eedge,
+ event_loc_info (m_dynamic_call.location,
+ dest_point.get_fndecl (),
+ dest_stack_depth)));
else
emission_path->add_event
- (make_unique<call_event> (eedge,
- event_loc_info (m_dynamic_call.location,
- src_point.get_fndecl (),
- src_stack_depth)));
+ (std::make_unique<call_event> (eedge,
+ event_loc_info (m_dynamic_call.location,
+ src_point.get_fndecl (),
+ src_stack_depth)));
}
/* class rewind_info_t : public custom_edge_info. */
const int dst_stack_depth = dst_point.get_stack_depth ();
emission_path->add_event
- (make_unique<rewind_from_longjmp_event>
- (&eedge,
- event_loc_info (get_longjmp_call ().location,
- src_point.get_fndecl (),
- src_stack_depth),
- this));
+ (std::make_unique<rewind_from_longjmp_event>
+ (&eedge,
+ event_loc_info (get_longjmp_call ().location,
+ src_point.get_fndecl (),
+ src_stack_depth),
+ this));
emission_path->add_event
- (make_unique<rewind_to_setjmp_event>
- (&eedge,
- event_loc_info (get_setjmp_call ().location,
- dst_point.get_fndecl (),
- dst_stack_depth),
- this));
+ (std::make_unique<rewind_to_setjmp_event>
+ (&eedge,
+ event_loc_info (get_setjmp_call ().location,
+ dst_point.get_fndecl (),
+ dst_stack_depth),
+ this));
}
/* class exploded_edge : public dedge<eg_traits>. */
std::unique_ptr<json::object>
exploded_edge::to_json () const
{
- auto eedge_obj = ::make_unique<json::object> ();
+ auto eedge_obj = std::make_unique<json::object> ();
eedge_obj->set_integer ("src_idx", m_src->m_index);
eedge_obj->set_integer ("dst_idx", m_dest->m_index);
if (m_sedge)
std::unique_ptr<json::array>
strongly_connected_components::to_json () const
{
- auto scc_arr = ::make_unique<json::array> ();
+ auto scc_arr = std::make_unique<json::array> ();
for (int i = 0; i < m_sg.num_nodes (); i++)
- scc_arr->append (::make_unique<json::integer_number> (get_scc_id (i)));
+ scc_arr->append (std::make_unique<json::integer_number> (get_scc_id (i)));
return scc_arr;
}
std::unique_ptr<json::object>
worklist::to_json () const
{
- auto worklist_obj = ::make_unique<json::object> ();
+ auto worklist_obj = std::make_unique<json::object> ();
worklist_obj->set ("scc", m_scc.to_json ());
const exploded_edge &) const final override
{
emission_path->add_event
- (make_unique<tainted_args_function_custom_event>
- (event_loc_info (DECL_SOURCE_LOCATION (m_fndecl), m_fndecl, 0)));
+ (std::make_unique<tainted_args_function_custom_event>
+ (event_loc_info (DECL_SOURCE_LOCATION (m_fndecl), m_fndecl, 0)));
}
private:
if (lookup_attribute ("tainted_args", DECL_ATTRIBUTES (fun.decl)))
{
if (mark_params_as_tainted (&state, fun.decl, m_ext_state))
- edge_info = make_unique<tainted_args_function_info> (fun.decl);
+ edge_info = std::make_unique<tainted_args_function_info> (fun.decl);
}
if (!state.m_valid)
/* Show the field in the struct declaration, e.g.
"(1) field 'store' is marked with '__attribute__((tainted_args))'" */
emission_path->add_event
- (make_unique<tainted_args_field_custom_event> (m_field));
+ (std::make_unique<tainted_args_field_custom_event> (m_field));
/* Show the callback in the initializer
e.g.
"(2) function 'gadget_dev_desc_UDC_store' used as initializer
for field 'store' marked with '__attribute__((tainted_args))'". */
emission_path->add_event
- (make_unique<tainted_args_callback_custom_event>
- (event_loc_info (m_loc, m_fndecl, 0),
- m_field));
+ (std::make_unique<tainted_args_callback_custom_event>
+ (event_loc_info (m_loc, m_fndecl, 0),
+ m_field));
}
private:
}
eg->add_edge (eg->get_origin (), enode, NULL, false,
- make_unique<tainted_args_call_info> (field, fndecl, loc));
+ std::make_unique<tainted_args_call_info> (field, fndecl, loc));
}
/* Callback for walk_tree for finding callbacks within initializers;
if (enode)
add_edge (node,enode, NULL,
false, /* No work is done by the call itself. */
- make_unique<dynamic_call_info_t> (call));
+ std::make_unique<dynamic_call_info_t> (call));
return true;
}
}
const svalue *fn_ptr_sval
= model->get_rvalue (fn_ptr, &ctxt);
if (fn_ptr_sval->all_zeroes_p ())
- ctxt.warn (make_unique<jump_through_null> (call));
+ ctxt.warn
+ (std::make_unique<jump_through_null> (call));
}
/* An unknown function or a special function was called
node);
if (enode)
add_edge (node, enode, NULL, false,
- make_unique<dynamic_call_info_t> (*call, true));
+ std::make_unique<dynamic_call_info_t> (*call, true));
}
}
}
std::unique_ptr<json::object>
exploded_graph::to_json () const
{
- auto egraph_obj = ::make_unique<json::object> ();
+ auto egraph_obj = std::make_unique<json::object> ();
/* Nodes. */
{
- auto nodes_arr = ::make_unique<json::array> ();
+ auto nodes_arr = std::make_unique<json::array> ();
unsigned i;
exploded_node *n;
FOR_EACH_VEC_ELT (m_nodes, i, n)
/* Edges. */
{
- auto edges_arr = ::make_unique<json::array> ();
+ auto edges_arr = std::make_unique<json::array> ();
unsigned i;
exploded_edge *n;
FOR_EACH_VEC_ELT (m_edges, i, n)
const program_point &src_point = src_enode.get_point ();
const gimple *last_stmt
= src_point.get_supernode ()->get_last_stmt ();
- *out = ::make_unique<feasibility_problem> (edge_idx, *eedge,
- last_stmt,
- std::move (rc));
+ *out = std::make_unique<feasibility_problem> (edge_idx, *eedge,
+ last_stmt,
+ std::move (rc));
}
return false;
}
return;
}
- auto toplev_obj = ::make_unique<json::object> ();
+ auto toplev_obj = std::make_unique<json::object> ();
toplev_obj->set ("sgraph", sg.to_json ());
toplev_obj->set ("egraph", eg.to_json ());
std::unique_ptr<json::object>
to_json () const
{
- auto loop_obj = ::make_unique<json::object> ();
+ auto loop_obj = std::make_unique<json::object> ();
loop_obj->set_integer ("enode", m_enode.m_index);
- auto edge_arr = ::make_unique<json::array> ();
+ auto edge_arr = std::make_unique<json::array> ();
for (auto eedge : m_eedge_vec)
edge_arr->append (eedge->to_json ());
loop_obj->set ("eedges", std::move (edge_arr));
checker_path *emission_path) final override
{
emission_path->add_event
- (make_unique<warning_event>
+ (std::make_unique<warning_event>
(event_loc_info (m_inf_loop->m_loc,
enode->get_function ()->decl,
enode->get_stack_depth ()),
if (switch_cfg_sedge->implicitly_created_default_p ())
{
emission_path->add_event
- (make_unique<perpetual_start_cfg_edge_event> (*eedge,
- loc_info_from));
+ (std::make_unique<perpetual_start_cfg_edge_event>
+ (*eedge,
+ loc_info_from));
emission_path->add_event
- (make_unique<end_cfg_edge_event>
- (*eedge,
- loc_info_to));
+ (std::make_unique<end_cfg_edge_event>
+ (*eedge,
+ loc_info_to));
}
}
if (cfg_sedge->true_value_p ())
{
emission_path->add_event
- (make_unique<perpetual_start_cfg_edge_event> (*eedge,
- loc_info_from));
+ (std::make_unique<perpetual_start_cfg_edge_event>
+ (*eedge,
+ loc_info_from));
emission_path->add_event
- (make_unique<end_cfg_edge_event>
- (*eedge,
- loc_info_to));
+ (std::make_unique<end_cfg_edge_event>
+ (*eedge,
+ loc_info_to));
}
else if (cfg_sedge->false_value_p ())
{
emission_path->add_event
- (make_unique<perpetual_start_cfg_edge_event> (*eedge,
- loc_info_from));
+ (std::make_unique<perpetual_start_cfg_edge_event>
+ (*eedge,
+ loc_info_from));
emission_path->add_event
- (make_unique<end_cfg_edge_event>
- (*eedge,
- loc_info_to));
+ (std::make_unique<end_cfg_edge_event>
+ (*eedge,
+ loc_info_to));
}
else if (cfg_sedge->back_edge_p ())
{
emission_path->add_event
- (make_unique<looping_back_event> (*eedge, loc_info_from));
+ (std::make_unique<looping_back_event> (*eedge, loc_info_from));
emission_path->add_event
- (make_unique<end_cfg_edge_event>
- (*eedge,
- loc_info_to));
+ (std::make_unique<end_cfg_edge_event>
+ (*eedge,
+ loc_info_to));
}
}
}
feasible_node *curr_fnode = nullptr;
if (flag_dump_analyzer_infinite_loop)
- fg = ::make_unique<feasible_graph> ();
+ fg = std::make_unique<feasible_graph> ();
location_t first_loc = UNKNOWN_LOCATION;
const exploded_node *iter = &enode;
fg->dump_dot (filename, nullptr, dump_args);
free (filename);
}
- return ::make_unique<infinite_loop> (enode,
- first_loc,
- std::move (eedges),
- logger);
+ return std::make_unique<infinite_loop> (enode,
+ first_loc,
+ std::move (eedges),
+ logger);
}
else
{
pending_location ploc (enode, snode, inf_loop->m_loc);
auto d
- = ::make_unique<infinite_loop_diagnostic> (std::move (inf_loop));
+ = std::make_unique<infinite_loop_diagnostic> (std::move (inf_loop));
get_diagnostic_manager ().add_diagnostic (ploc, std::move (d));
}
}
{
gcc_assert (m_prev_entry_event == NULL);
std::unique_ptr<checker_event> prev_entry_event
- = make_unique <recursive_function_entry_event> (dst_point,
- *this, false);
+ = std::make_unique <recursive_function_entry_event> (dst_point,
+ *this, false);
m_prev_entry_event = prev_entry_event.get ();
emission_path->add_event (std::move (prev_entry_event));
}
else if (eedge.m_dest == m_new_entry_enode)
emission_path->add_event
- (make_unique<recursive_function_entry_event> (dst_point, *this, true));
+ (std::make_unique<recursive_function_entry_event>
+ (dst_point, *this, true));
else
pending_diagnostic::add_function_entry_event (eedge, emission_path);
}
{
gcc_assert (m_new_entry_enode);
emission_path->add_event
- (make_unique<warning_event>
+ (std::make_unique<warning_event>
(event_loc_info (m_new_entry_enode->get_supernode
()->get_start_location (),
m_callee_fndecl,
nullptr);
get_diagnostic_manager ().add_diagnostic
(ploc,
- make_unique<infinite_recursion_diagnostic> (prev_entry_enode,
- enode,
- fndecl));
+ std::make_unique<infinite_recursion_diagnostic> (prev_entry_enode,
+ enode,
+ fndecl));
}
region_model_context *ctxt = cd.get_ctxt ();
if (!ctxt)
return;
- ctxt->warn (make_unique<dump_path_diagnostic> ());
+ ctxt->warn (std::make_unique<dump_path_diagnostic> ());
}
};
void
register_known_analyzer_functions (known_function_manager &kfm)
{
- kfm.add ("__analyzer_break", make_unique<kf_analyzer_break> ());
- kfm.add ("__analyzer_describe", make_unique<kf_analyzer_describe> ());
+ kfm.add ("__analyzer_break",
+ std::make_unique<kf_analyzer_break> ());
+ kfm.add ("__analyzer_describe",
+ std::make_unique<kf_analyzer_describe> ());
kfm.add ("__analyzer_dump_capacity",
- make_unique<kf_analyzer_dump_capacity> ());
- kfm.add ("__analyzer_dump_escaped", make_unique<kf_analyzer_dump_escaped> ());
+ std::make_unique<kf_analyzer_dump_capacity> ());
+ kfm.add ("__analyzer_dump_escaped",
+ std::make_unique<kf_analyzer_dump_escaped> ());
kfm.add ("__analyzer_dump_exploded_nodes",
- make_unique<kf_analyzer_dump_exploded_nodes> ());
+ std::make_unique<kf_analyzer_dump_exploded_nodes> ());
kfm.add ("__analyzer_dump_named_constant",
- make_unique<kf_analyzer_dump_named_constant> ());
- kfm.add ("__analyzer_dump_path", make_unique<kf_analyzer_dump_path> ());
+ std::make_unique<kf_analyzer_dump_named_constant> ());
+ kfm.add ("__analyzer_dump_path",
+ std::make_unique<kf_analyzer_dump_path> ());
kfm.add ("__analyzer_dump_region_model",
- make_unique<kf_analyzer_dump_region_model> ());
- kfm.add ("__analyzer_eval", make_unique<kf_analyzer_eval> ());
+ std::make_unique<kf_analyzer_dump_region_model> ());
+ kfm.add ("__analyzer_eval",
+ std::make_unique<kf_analyzer_eval> ());
kfm.add ("__analyzer_get_unknown_ptr",
- make_unique<kf_analyzer_get_unknown_ptr> ());
- kfm.add ("__analyzer_get_strlen", make_kf_strlen ());
+ std::make_unique<kf_analyzer_get_unknown_ptr> ());
+ kfm.add ("__analyzer_get_strlen",
+ make_kf_strlen ());
}
} // namespace ana
void
register_known_functions_lang_cp (known_function_manager &kfm)
{
- kfm.add ("operator new", make_unique<kf_operator_new> ());
- kfm.add ("operator new []", make_unique<kf_operator_new> ());
- kfm.add ("operator delete", make_unique<kf_operator_delete> ());
- kfm.add ("operator delete []", make_unique<kf_operator_delete> ());
+ kfm.add ("operator new", std::make_unique<kf_operator_new> ());
+ kfm.add ("operator new []", std::make_unique<kf_operator_new> ());
+ kfm.add ("operator delete", std::make_unique<kf_operator_delete> ());
+ kfm.add ("operator delete []", std::make_unique<kf_operator_delete> ());
}
} // namespace ana
break;
case MEMSPACE_STACK:
if (ctxt)
- ctxt->warn (make_unique<putenv_of_auto_var> (fndecl, reg));
+ ctxt->warn (std::make_unique<putenv_of_auto_var> (fndecl, reg));
break;
}
cd.set_any_lhs_with_defaults ();
if (cd.get_ctxt ())
{
- cd.get_ctxt ()->bifurcate (make_unique<failure> (cd));
- cd.get_ctxt ()->bifurcate (make_unique<success_no_move> (cd));
- cd.get_ctxt ()->bifurcate (make_unique<success_with_move> (cd));
+ cd.get_ctxt ()->bifurcate (std::make_unique<failure> (cd));
+ cd.get_ctxt ()->bifurcate (std::make_unique<success_no_move> (cd));
+ cd.get_ctxt ()->bifurcate (std::make_unique<success_with_move> (cd));
cd.get_ctxt ()->terminate_path ();
}
}
/* Body of kf_strchr::impl_call_post. */
if (cd.get_ctxt ())
{
- cd.get_ctxt ()->bifurcate (make_unique<strchr_call_info> (cd, false));
- cd.get_ctxt ()->bifurcate (make_unique<strchr_call_info> (cd, true));
+ cd.get_ctxt ()->bifurcate (std::make_unique<strchr_call_info> (cd, false));
+ cd.get_ctxt ()->bifurcate (std::make_unique<strchr_call_info> (cd, true));
cd.get_ctxt ()->terminate_path ();
}
}
std::unique_ptr<known_function>
make_kf_strlen ()
{
- return make_unique<kf_strlen> ();
+ return std::make_unique<kf_strlen> ();
}
/* Handler for "strncpy" and "__builtin_strncpy".
nullptr,
nullptr);
cd.get_ctxt ()->bifurcate
- (make_unique<strncpy_call_info> (cd, num_bytes_with_terminator_sval,
- false));
+ (std::make_unique<strncpy_call_info>
+ (cd, num_bytes_with_terminator_sval,
+ false));
cd.get_ctxt ()->bifurcate
- (make_unique<strncpy_call_info> (cd, num_bytes_with_terminator_sval,
- true));
+ (std::make_unique<strncpy_call_info>
+ (cd, num_bytes_with_terminator_sval,
+ true));
cd.get_ctxt ()->terminate_path ();
}
};
/* Body of kf_strstr::impl_call_post. */
if (cd.get_ctxt ())
{
- cd.get_ctxt ()->bifurcate (make_unique<strstr_call_info> (cd, false));
- cd.get_ctxt ()->bifurcate (make_unique<strstr_call_info> (cd, true));
+ cd.get_ctxt ()->bifurcate (std::make_unique<strstr_call_info> (cd, false));
+ cd.get_ctxt ()->bifurcate (std::make_unique<strstr_call_info> (cd, true));
cd.get_ctxt ()->terminate_path ();
}
}
if (cd.get_arg_svalue (0)->all_zeroes_p ())
{
if (ctxt)
- ctxt->warn (::make_unique<undefined_behavior> (cd));
+ ctxt->warn (::std::make_unique<undefined_behavior> (cd));
}
/* Assume that "str" was actually non-null; terminate
Typically the str is either null or non-null at a particular site,
so hopefully this will generally just lead to two out-edges. */
cd.get_ctxt ()->bifurcate
- (make_unique<strtok_call_info> (cd, m_private_reg, false, false));
+ (std::make_unique<strtok_call_info> (cd, m_private_reg, false, false));
cd.get_ctxt ()->bifurcate
- (make_unique<strtok_call_info> (cd, m_private_reg, false, true));
+ (std::make_unique<strtok_call_info> (cd, m_private_reg, false, true));
cd.get_ctxt ()->bifurcate
- (make_unique<strtok_call_info> (cd, m_private_reg, true, false));
+ (std::make_unique<strtok_call_info> (cd, m_private_reg, true, false));
cd.get_ctxt ()->bifurcate
- (make_unique<strtok_call_info> (cd, m_private_reg, true, true));
+ (std::make_unique<strtok_call_info> (cd, m_private_reg, true, true));
cd.get_ctxt ()->terminate_path ();
}
}
static void
register_atomic_builtins (known_function_manager &kfm)
{
- kfm.add (BUILT_IN_ATOMIC_EXCHANGE, make_unique<kf_atomic_exchange> ());
- kfm.add (BUILT_IN_ATOMIC_EXCHANGE_N, make_unique<kf_atomic_exchange_n> ());
- kfm.add (BUILT_IN_ATOMIC_EXCHANGE_1, make_unique<kf_atomic_exchange_n> ());
- kfm.add (BUILT_IN_ATOMIC_EXCHANGE_2, make_unique<kf_atomic_exchange_n> ());
- kfm.add (BUILT_IN_ATOMIC_EXCHANGE_4, make_unique<kf_atomic_exchange_n> ());
- kfm.add (BUILT_IN_ATOMIC_EXCHANGE_8, make_unique<kf_atomic_exchange_n> ());
- kfm.add (BUILT_IN_ATOMIC_EXCHANGE_16, make_unique<kf_atomic_exchange_n> ());
- kfm.add (BUILT_IN_ATOMIC_LOAD, make_unique<kf_atomic_load> ());
- kfm.add (BUILT_IN_ATOMIC_LOAD_N, make_unique<kf_atomic_load_n> ());
- kfm.add (BUILT_IN_ATOMIC_LOAD_1, make_unique<kf_atomic_load_n> ());
- kfm.add (BUILT_IN_ATOMIC_LOAD_2, make_unique<kf_atomic_load_n> ());
- kfm.add (BUILT_IN_ATOMIC_LOAD_4, make_unique<kf_atomic_load_n> ());
- kfm.add (BUILT_IN_ATOMIC_LOAD_8, make_unique<kf_atomic_load_n> ());
- kfm.add (BUILT_IN_ATOMIC_LOAD_16, make_unique<kf_atomic_load_n> ());
- kfm.add (BUILT_IN_ATOMIC_STORE, make_unique<kf_atomic_store> ());
- kfm.add (BUILT_IN_ATOMIC_STORE_N, make_unique<kf_atomic_store_n> ());
- kfm.add (BUILT_IN_ATOMIC_STORE_1, make_unique<kf_atomic_store_n> ());
- kfm.add (BUILT_IN_ATOMIC_STORE_2, make_unique<kf_atomic_store_n> ());
- kfm.add (BUILT_IN_ATOMIC_STORE_4, make_unique<kf_atomic_store_n> ());
- kfm.add (BUILT_IN_ATOMIC_STORE_8, make_unique<kf_atomic_store_n> ());
- kfm.add (BUILT_IN_ATOMIC_STORE_16, make_unique<kf_atomic_store_n> ());
+ kfm.add (BUILT_IN_ATOMIC_EXCHANGE, std::make_unique<kf_atomic_exchange> ());
+ kfm.add (BUILT_IN_ATOMIC_EXCHANGE_N, std::make_unique<kf_atomic_exchange_n> ());
+ kfm.add (BUILT_IN_ATOMIC_EXCHANGE_1, std::make_unique<kf_atomic_exchange_n> ());
+ kfm.add (BUILT_IN_ATOMIC_EXCHANGE_2, std::make_unique<kf_atomic_exchange_n> ());
+ kfm.add (BUILT_IN_ATOMIC_EXCHANGE_4, std::make_unique<kf_atomic_exchange_n> ());
+ kfm.add (BUILT_IN_ATOMIC_EXCHANGE_8, std::make_unique<kf_atomic_exchange_n> ());
+ kfm.add (BUILT_IN_ATOMIC_EXCHANGE_16, std::make_unique<kf_atomic_exchange_n> ());
+ kfm.add (BUILT_IN_ATOMIC_LOAD, std::make_unique<kf_atomic_load> ());
+ kfm.add (BUILT_IN_ATOMIC_LOAD_N, std::make_unique<kf_atomic_load_n> ());
+ kfm.add (BUILT_IN_ATOMIC_LOAD_1, std::make_unique<kf_atomic_load_n> ());
+ kfm.add (BUILT_IN_ATOMIC_LOAD_2, std::make_unique<kf_atomic_load_n> ());
+ kfm.add (BUILT_IN_ATOMIC_LOAD_4, std::make_unique<kf_atomic_load_n> ());
+ kfm.add (BUILT_IN_ATOMIC_LOAD_8, std::make_unique<kf_atomic_load_n> ());
+ kfm.add (BUILT_IN_ATOMIC_LOAD_16, std::make_unique<kf_atomic_load_n> ());
+ kfm.add (BUILT_IN_ATOMIC_STORE, std::make_unique<kf_atomic_store> ());
+ kfm.add (BUILT_IN_ATOMIC_STORE_N, std::make_unique<kf_atomic_store_n> ());
+ kfm.add (BUILT_IN_ATOMIC_STORE_1, std::make_unique<kf_atomic_store_n> ());
+ kfm.add (BUILT_IN_ATOMIC_STORE_2, std::make_unique<kf_atomic_store_n> ());
+ kfm.add (BUILT_IN_ATOMIC_STORE_4, std::make_unique<kf_atomic_store_n> ());
+ kfm.add (BUILT_IN_ATOMIC_STORE_8, std::make_unique<kf_atomic_store_n> ());
+ kfm.add (BUILT_IN_ATOMIC_STORE_16, std::make_unique<kf_atomic_store_n> ());
kfm.add (BUILT_IN_ATOMIC_ADD_FETCH_1,
- make_unique<kf_atomic_op_fetch> (PLUS_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (PLUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_ADD_FETCH_2,
- make_unique<kf_atomic_op_fetch> (PLUS_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (PLUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_ADD_FETCH_4,
- make_unique<kf_atomic_op_fetch> (PLUS_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (PLUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_ADD_FETCH_8,
- make_unique<kf_atomic_op_fetch> (PLUS_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (PLUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_ADD_FETCH_16,
- make_unique<kf_atomic_op_fetch> (PLUS_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (PLUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_SUB_FETCH_1,
- make_unique<kf_atomic_op_fetch> (MINUS_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (MINUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_SUB_FETCH_2,
- make_unique<kf_atomic_op_fetch> (MINUS_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (MINUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_SUB_FETCH_4,
- make_unique<kf_atomic_op_fetch> (MINUS_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (MINUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_SUB_FETCH_8,
- make_unique<kf_atomic_op_fetch> (MINUS_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (MINUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_SUB_FETCH_16,
- make_unique<kf_atomic_op_fetch> (MINUS_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (MINUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_AND_FETCH_1,
- make_unique<kf_atomic_op_fetch> (BIT_AND_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (BIT_AND_EXPR));
kfm.add (BUILT_IN_ATOMIC_AND_FETCH_2,
- make_unique<kf_atomic_op_fetch> (BIT_AND_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (BIT_AND_EXPR));
kfm.add (BUILT_IN_ATOMIC_AND_FETCH_4,
- make_unique<kf_atomic_op_fetch> (BIT_AND_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (BIT_AND_EXPR));
kfm.add (BUILT_IN_ATOMIC_AND_FETCH_8,
- make_unique<kf_atomic_op_fetch> (BIT_AND_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (BIT_AND_EXPR));
kfm.add (BUILT_IN_ATOMIC_AND_FETCH_16,
- make_unique<kf_atomic_op_fetch> (BIT_AND_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (BIT_AND_EXPR));
kfm.add (BUILT_IN_ATOMIC_XOR_FETCH_1,
- make_unique<kf_atomic_op_fetch> (BIT_XOR_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (BIT_XOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_XOR_FETCH_2,
- make_unique<kf_atomic_op_fetch> (BIT_XOR_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (BIT_XOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_XOR_FETCH_4,
- make_unique<kf_atomic_op_fetch> (BIT_XOR_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (BIT_XOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_XOR_FETCH_8,
- make_unique<kf_atomic_op_fetch> (BIT_XOR_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (BIT_XOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_XOR_FETCH_16,
- make_unique<kf_atomic_op_fetch> (BIT_XOR_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (BIT_XOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_OR_FETCH_1,
- make_unique<kf_atomic_op_fetch> (BIT_IOR_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (BIT_IOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_OR_FETCH_2,
- make_unique<kf_atomic_op_fetch> (BIT_IOR_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (BIT_IOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_OR_FETCH_4,
- make_unique<kf_atomic_op_fetch> (BIT_IOR_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (BIT_IOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_OR_FETCH_8,
- make_unique<kf_atomic_op_fetch> (BIT_IOR_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (BIT_IOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_OR_FETCH_16,
- make_unique<kf_atomic_op_fetch> (BIT_IOR_EXPR));
+ std::make_unique<kf_atomic_op_fetch> (BIT_IOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_ADD_1,
- make_unique<kf_atomic_fetch_op> (PLUS_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (PLUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_ADD_2,
- make_unique<kf_atomic_fetch_op> (PLUS_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (PLUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_ADD_4,
- make_unique<kf_atomic_fetch_op> (PLUS_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (PLUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_ADD_8,
- make_unique<kf_atomic_fetch_op> (PLUS_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (PLUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_ADD_16,
- make_unique<kf_atomic_fetch_op> (PLUS_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (PLUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_SUB_1,
- make_unique<kf_atomic_fetch_op> (MINUS_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (MINUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_SUB_2,
- make_unique<kf_atomic_fetch_op> (MINUS_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (MINUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_SUB_4,
- make_unique<kf_atomic_fetch_op> (MINUS_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (MINUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_SUB_8,
- make_unique<kf_atomic_fetch_op> (MINUS_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (MINUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_SUB_16,
- make_unique<kf_atomic_fetch_op> (MINUS_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (MINUS_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_AND_1,
- make_unique<kf_atomic_fetch_op> (BIT_AND_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (BIT_AND_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_AND_2,
- make_unique<kf_atomic_fetch_op> (BIT_AND_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (BIT_AND_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_AND_4,
- make_unique<kf_atomic_fetch_op> (BIT_AND_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (BIT_AND_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_AND_8,
- make_unique<kf_atomic_fetch_op> (BIT_AND_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (BIT_AND_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_AND_16,
- make_unique<kf_atomic_fetch_op> (BIT_AND_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (BIT_AND_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_XOR_1,
- make_unique<kf_atomic_fetch_op> (BIT_XOR_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (BIT_XOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_XOR_2,
- make_unique<kf_atomic_fetch_op> (BIT_XOR_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (BIT_XOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_XOR_4,
- make_unique<kf_atomic_fetch_op> (BIT_XOR_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (BIT_XOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_XOR_8,
- make_unique<kf_atomic_fetch_op> (BIT_XOR_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (BIT_XOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_XOR_16,
- make_unique<kf_atomic_fetch_op> (BIT_XOR_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (BIT_XOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_OR_1,
- make_unique<kf_atomic_fetch_op> (BIT_IOR_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (BIT_IOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_OR_2,
- make_unique<kf_atomic_fetch_op> (BIT_IOR_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (BIT_IOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_OR_4,
- make_unique<kf_atomic_fetch_op> (BIT_IOR_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (BIT_IOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_OR_8,
- make_unique<kf_atomic_fetch_op> (BIT_IOR_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (BIT_IOR_EXPR));
kfm.add (BUILT_IN_ATOMIC_FETCH_OR_16,
- make_unique<kf_atomic_fetch_op> (BIT_IOR_EXPR));
+ std::make_unique<kf_atomic_fetch_op> (BIT_IOR_EXPR));
}
/* Handle calls to the various IFN_UBSAN_* with no return value.
/* Handle calls to the various IFN_UBSAN_* with no return value.
For now, treat these as no-ops. */
kfm.add (IFN_UBSAN_NULL,
- make_unique<kf_ubsan_noop> ());
+ std::make_unique<kf_ubsan_noop> ());
kfm.add (IFN_UBSAN_BOUNDS,
- make_unique<kf_ubsan_noop> ());
+ std::make_unique<kf_ubsan_noop> ());
kfm.add (IFN_UBSAN_PTR,
- make_unique<kf_ubsan_noop> ());
+ std::make_unique<kf_ubsan_noop> ());
kfm.add (BUILT_IN_UBSAN_HANDLE_NONNULL_ARG,
- make_unique<kf_ubsan_handler> ());
+ std::make_unique<kf_ubsan_handler> ());
}
/* Populate KFM with instances of known functions supported by the core of the
/* Internal fns the analyzer has known_functions for. */
{
- kfm.add (IFN_BUILTIN_EXPECT, make_unique<kf_expect> ());
+ kfm.add (IFN_BUILTIN_EXPECT, std::make_unique<kf_expect> ());
}
/* GCC built-ins that do not correspond to a function
in the standard library. */
{
- kfm.add (BUILT_IN_EXPECT, make_unique<kf_expect> ());
- kfm.add (BUILT_IN_EXPECT_WITH_PROBABILITY, make_unique<kf_expect> ());
- kfm.add (BUILT_IN_ALLOCA_WITH_ALIGN, make_unique<kf_alloca> ());
- kfm.add (BUILT_IN_STACK_RESTORE, make_unique<kf_stack_restore> ());
- kfm.add (BUILT_IN_STACK_SAVE, make_unique<kf_stack_save> ());
+ kfm.add (BUILT_IN_EXPECT, std::make_unique<kf_expect> ());
+ kfm.add (BUILT_IN_EXPECT_WITH_PROBABILITY, std::make_unique<kf_expect> ());
+ kfm.add (BUILT_IN_ALLOCA_WITH_ALIGN, std::make_unique<kf_alloca> ());
+ kfm.add (BUILT_IN_STACK_RESTORE, std::make_unique<kf_stack_restore> ());
+ kfm.add (BUILT_IN_STACK_SAVE, std::make_unique<kf_stack_save> ());
register_atomic_builtins (kfm);
register_sanitizer_builtins (kfm);
/* Known builtins and C standard library functions
the analyzer has known functions for. */
{
- kfm.add ("alloca", make_unique<kf_alloca> ());
- kfm.add ("__builtin_alloca", make_unique<kf_alloca> ());
- kfm.add ("calloc", make_unique<kf_calloc> ());
- kfm.add ("__builtin_calloc", make_unique<kf_calloc> ());
- kfm.add ("free", make_unique<kf_free> ());
- kfm.add ("__builtin_free", make_unique<kf_free> ());
- kfm.add ("malloc", make_unique<kf_malloc> ());
- kfm.add ("__builtin_malloc", make_unique<kf_malloc> ());
+ kfm.add ("alloca", std::make_unique<kf_alloca> ());
+ kfm.add ("__builtin_alloca", std::make_unique<kf_alloca> ());
+ kfm.add ("calloc", std::make_unique<kf_calloc> ());
+ kfm.add ("__builtin_calloc", std::make_unique<kf_calloc> ());
+ kfm.add ("free", std::make_unique<kf_free> ());
+ kfm.add ("__builtin_free", std::make_unique<kf_free> ());
+ kfm.add ("malloc", std::make_unique<kf_malloc> ());
+ kfm.add ("__builtin_malloc", std::make_unique<kf_malloc> ());
kfm.add ("memcpy",
- make_unique<kf_memcpy_memmove> (kf_memcpy_memmove::KF_MEMCPY));
+ std::make_unique<kf_memcpy_memmove> (kf_memcpy_memmove::KF_MEMCPY));
kfm.add ("__builtin_memcpy",
- make_unique<kf_memcpy_memmove> (kf_memcpy_memmove::KF_MEMCPY));
- kfm.add ("__memcpy_chk", make_unique<kf_memcpy_memmove>
+ std::make_unique<kf_memcpy_memmove> (kf_memcpy_memmove::KF_MEMCPY));
+ kfm.add ("__memcpy_chk", std::make_unique<kf_memcpy_memmove>
(kf_memcpy_memmove::KF_MEMCPY_CHK));
- kfm.add ("__builtin___memcpy_chk", make_unique<kf_memcpy_memmove>
+ kfm.add ("__builtin___memcpy_chk", std::make_unique<kf_memcpy_memmove>
(kf_memcpy_memmove::KF_MEMCPY_CHK));
kfm.add ("memmove",
- make_unique<kf_memcpy_memmove> (kf_memcpy_memmove::KF_MEMMOVE));
+ std::make_unique<kf_memcpy_memmove> (kf_memcpy_memmove::KF_MEMMOVE));
kfm.add ("__builtin_memmove",
- make_unique<kf_memcpy_memmove> (kf_memcpy_memmove::KF_MEMMOVE));
- kfm.add ("__memmove_chk", make_unique<kf_memcpy_memmove>
+ std::make_unique<kf_memcpy_memmove> (kf_memcpy_memmove::KF_MEMMOVE));
+ kfm.add ("__memmove_chk", std::make_unique<kf_memcpy_memmove>
(kf_memcpy_memmove::KF_MEMMOVE_CHK));
- kfm.add ("__builtin___memmove_chk", make_unique<kf_memcpy_memmove>
+ kfm.add ("__builtin___memmove_chk", std::make_unique<kf_memcpy_memmove>
(kf_memcpy_memmove::KF_MEMMOVE_CHK));
- kfm.add ("memset", make_unique<kf_memset> (false));
- kfm.add ("__builtin_memset", make_unique<kf_memset> (false));
- kfm.add ("__memset_chk", make_unique<kf_memset> (true));
- kfm.add ("__builtin___memset_chk", make_unique<kf_memset> (true));
- kfm.add ("realloc", make_unique<kf_realloc> ());
- kfm.add ("__builtin_realloc", make_unique<kf_realloc> ());
- kfm.add ("sprintf", make_unique<kf_sprintf> ());
- kfm.add ("__builtin_sprintf", make_unique<kf_sprintf> ());
- kfm.add ("strchr", make_unique<kf_strchr> ());
- kfm.add ("__builtin_strchr", make_unique<kf_strchr> ());
- kfm.add ("strcpy", make_unique<kf_strcpy> (2, false));
- kfm.add ("__builtin_strcpy", make_unique<kf_strcpy> (2, false));
- kfm.add ("__strcpy_chk", make_unique<kf_strcpy> (3, true));
- kfm.add ("__builtin___strcpy_chk", make_unique<kf_strcpy> (3, true));
- kfm.add ("strcat", make_unique<kf_strcat> (2, false));
- kfm.add ("__builtin_strcat", make_unique<kf_strcat> (2, false));
- kfm.add ("__strcat_chk", make_unique<kf_strcat> (3, true));
- kfm.add ("__builtin___strcat_chk", make_unique<kf_strcat> (3, true));
- kfm.add ("strdup", make_unique<kf_strdup> ());
- kfm.add ("__builtin_strdup", make_unique<kf_strdup> ());
- kfm.add ("strncpy", make_unique<kf_strncpy> ());
- kfm.add ("__builtin_strncpy", make_unique<kf_strncpy> ());
- kfm.add ("strndup", make_unique<kf_strndup> ());
- kfm.add ("__builtin_strndup", make_unique<kf_strndup> ());
- kfm.add ("strlen", make_unique<kf_strlen> ());
- kfm.add ("__builtin_strlen", make_unique<kf_strlen> ());
- kfm.add ("strstr", make_unique<kf_strstr> ());
- kfm.add ("__builtin_strstr", make_unique<kf_strstr> ());
+ kfm.add ("memset", std::make_unique<kf_memset> (false));
+ kfm.add ("__builtin_memset", std::make_unique<kf_memset> (false));
+ kfm.add ("__memset_chk", std::make_unique<kf_memset> (true));
+ kfm.add ("__builtin___memset_chk", std::make_unique<kf_memset> (true));
+ kfm.add ("realloc", std::make_unique<kf_realloc> ());
+ kfm.add ("__builtin_realloc", std::make_unique<kf_realloc> ());
+ kfm.add ("sprintf", std::make_unique<kf_sprintf> ());
+ kfm.add ("__builtin_sprintf", std::make_unique<kf_sprintf> ());
+ kfm.add ("strchr", std::make_unique<kf_strchr> ());
+ kfm.add ("__builtin_strchr", std::make_unique<kf_strchr> ());
+ kfm.add ("strcpy", std::make_unique<kf_strcpy> (2, false));
+ kfm.add ("__builtin_strcpy", std::make_unique<kf_strcpy> (2, false));
+ kfm.add ("__strcpy_chk", std::make_unique<kf_strcpy> (3, true));
+ kfm.add ("__builtin___strcpy_chk", std::make_unique<kf_strcpy> (3, true));
+ kfm.add ("strcat", std::make_unique<kf_strcat> (2, false));
+ kfm.add ("__builtin_strcat", std::make_unique<kf_strcat> (2, false));
+ kfm.add ("__strcat_chk", std::make_unique<kf_strcat> (3, true));
+ kfm.add ("__builtin___strcat_chk", std::make_unique<kf_strcat> (3, true));
+ kfm.add ("strdup", std::make_unique<kf_strdup> ());
+ kfm.add ("__builtin_strdup", std::make_unique<kf_strdup> ());
+ kfm.add ("strncpy", std::make_unique<kf_strncpy> ());
+ kfm.add ("__builtin_strncpy", std::make_unique<kf_strncpy> ());
+ kfm.add ("strndup", std::make_unique<kf_strndup> ());
+ kfm.add ("__builtin_strndup", std::make_unique<kf_strndup> ());
+ kfm.add ("strlen", std::make_unique<kf_strlen> ());
+ kfm.add ("__builtin_strlen", std::make_unique<kf_strlen> ());
+ kfm.add ("strstr", std::make_unique<kf_strstr> ());
+ kfm.add ("__builtin_strstr", std::make_unique<kf_strstr> ());
register_atomic_builtins (kfm);
register_varargs_builtins (kfm);
/* Known POSIX functions, and some non-standard extensions. */
{
- kfm.add ("fopen", make_unique<kf_fopen> ());
- kfm.add ("putenv", make_unique<kf_putenv> ());
- kfm.add ("strtok", make_unique<kf_strtok> (rmm));
+ kfm.add ("fopen", std::make_unique<kf_fopen> ());
+ kfm.add ("putenv", std::make_unique<kf_putenv> ());
+ kfm.add ("strtok", std::make_unique<kf_strtok> (rmm));
register_known_fd_functions (kfm);
register_known_file_functions (kfm);
/* glibc functions. */
{
- kfm.add ("__errno_location", make_unique<kf_errno_location> ());
- kfm.add ("error", make_unique<kf_error> (3));
- kfm.add ("error_at_line", make_unique<kf_error> (5));
+ kfm.add ("__errno_location", std::make_unique<kf_errno_location> ());
+ kfm.add ("error", std::make_unique<kf_error> (3));
+ kfm.add ("error_at_line", std::make_unique<kf_error> (5));
/* Variants of "error" and "error_at_line" seen by the
analyzer at -O0 (PR analyzer/115724). */
- kfm.add ("__error_alias", make_unique<kf_error> (3));
- kfm.add ("__error_at_line_alias", make_unique<kf_error> (5));
+ kfm.add ("__error_alias", std::make_unique<kf_error> (3));
+ kfm.add ("__error_at_line_alias", std::make_unique<kf_error> (5));
}
/* Other implementations of C standard library. */
#define errno (*__error())
and similarly __errno for newlib.
Add these as synonyms for "__errno_location". */
- kfm.add ("___errno", make_unique<kf_errno_location> ());
- kfm.add ("__error", make_unique<kf_errno_location> ());
- kfm.add ("__errno", make_unique<kf_errno_location> ());
+ kfm.add ("___errno", std::make_unique<kf_errno_location> ());
+ kfm.add ("__error", std::make_unique<kf_errno_location> ());
+ kfm.add ("__errno", std::make_unique<kf_errno_location> ());
}
/* Language-specific support functions. */
from <cstdlib> etc for the C spellings of these headers (e.g. <stdlib.h>),
so we must match against these too. */
{
- kfm.add_std_ns ("malloc", make_unique<kf_malloc> ());
- kfm.add_std_ns ("free", make_unique<kf_free> ());
- kfm.add_std_ns ("realloc", make_unique<kf_realloc> ());
- kfm.add_std_ns ("calloc", make_unique<kf_calloc> ());
+ kfm.add_std_ns ("malloc", std::make_unique<kf_malloc> ());
+ kfm.add_std_ns ("free", std::make_unique<kf_free> ());
+ kfm.add_std_ns ("realloc", std::make_unique<kf_realloc> ());
+ kfm.add_std_ns ("calloc", std::make_unique<kf_calloc> ());
kfm.add_std_ns
("memcpy",
- make_unique<kf_memcpy_memmove> (kf_memcpy_memmove::KF_MEMCPY));
+ std::make_unique<kf_memcpy_memmove> (kf_memcpy_memmove::KF_MEMCPY));
kfm.add_std_ns
("memmove",
- make_unique<kf_memcpy_memmove> (kf_memcpy_memmove::KF_MEMMOVE));
- kfm.add_std_ns ("memset", make_unique<kf_memset> (false));
- kfm.add_std_ns ("strcat", make_unique<kf_strcat> (2, false));
- kfm.add_std_ns ("strcpy", make_unique<kf_strcpy> (2, false));
- kfm.add_std_ns ("strlen", make_unique<kf_strlen> ());
- kfm.add_std_ns ("strncpy", make_unique<kf_strncpy> ());
- kfm.add_std_ns ("strtok", make_unique<kf_strtok> (rmm));
+ std::make_unique<kf_memcpy_memmove> (kf_memcpy_memmove::KF_MEMMOVE));
+ kfm.add_std_ns ("memset", std::make_unique<kf_memset> (false));
+ kfm.add_std_ns ("strcat", std::make_unique<kf_strcat> (2, false));
+ kfm.add_std_ns ("strcpy", std::make_unique<kf_strcpy> (2, false));
+ kfm.add_std_ns ("strlen", std::make_unique<kf_strlen> ());
+ kfm.add_std_ns ("strncpy", std::make_unique<kf_strncpy> ());
+ kfm.add_std_ns ("strtok", std::make_unique<kf_strtok> (rmm));
}
}
{
const exploded_node *dst_node = eedge.m_dest;
const program_point &dst_point = dst_node->get_point ();
- emission_path->add_event (make_unique<function_entry_event> (dst_point));
+ emission_path->add_event (std::make_unique<function_entry_event> (dst_point));
}
/* Base implementation of pending_diagnostic::add_call_event.
const int src_stack_depth = src_point.get_stack_depth ();
const gimple *last_stmt = src_point.get_supernode ()->get_last_stmt ();
emission_path->add_event
- (make_unique<call_event> (eedge,
- event_loc_info (last_stmt
- ? last_stmt->location
- : UNKNOWN_LOCATION,
- src_point.get_fndecl (),
- src_stack_depth)));
+ (std::make_unique<call_event> (eedge,
+ event_loc_info (last_stmt
+ ? last_stmt->location
+ : UNKNOWN_LOCATION,
+ src_point.get_fndecl (),
+ src_stack_depth)));
}
/* Base implementation of pending_diagnostic::add_region_creation_events.
checker_path &emission_path)
{
emission_path.add_event
- (make_unique<region_creation_event_memory_space> (reg->get_memory_space (),
- loc_info));
+ (std::make_unique<region_creation_event_memory_space>
+ (reg->get_memory_space (),
+ loc_info));
if (capacity)
emission_path.add_event
- (make_unique<region_creation_event_capacity> (capacity, loc_info));
+ (std::make_unique<region_creation_event_capacity> (capacity, loc_info));
}
/* Base implementation of pending_diagnostic::add_final_event.
checker_path *emission_path)
{
emission_path->add_event
- (make_unique<warning_event>
+ (std::make_unique<warning_event>
(loc_info,
enode,
sm, var, state));
#include "diagnostic-event-id.h"
#include "gcc-rich-location.h"
#include "gimple-pretty-print.h"
-#include "make-unique.h"
#include "sbitmap.h"
#include "selftest.h"
#include "shortest-paths.h"
std::unique_ptr<json::object>
program_point::to_json () const
{
- auto point_obj = ::make_unique<json::object> ();
+ auto point_obj = std::make_unique<json::object> ();
point_obj->set_string ("kind", point_kind_to_string (get_kind ()));
std::unique_ptr<json::object>
extrinsic_state::to_json () const
{
- auto ext_state_obj = ::make_unique<json::object> ();
+ auto ext_state_obj = std::make_unique<json::object> ();
{
- auto checkers_arr = ::make_unique<json::array> ();
+ auto checkers_arr = std::make_unique<json::array> ();
for (auto &sm : m_checkers)
checkers_arr->append (sm->to_json ());
ext_state_obj->set ("checkers", std::move (checkers_arr));
std::unique_ptr<json::object>
sm_state_map::to_json () const
{
- auto map_obj = ::make_unique<json::object> ();
+ auto map_obj = std::make_unique<json::object> ();
if (m_global_state != m_sm.get_start_state ())
map_obj->set ("global", m_global_state->to_json ());
std::unique_ptr<json::object>
program_state::to_json (const extrinsic_state &ext_state) const
{
- auto state_obj = ::make_unique<json::object> ();
+ auto state_obj = std::make_unique<json::object> ();
state_obj->set ("store", m_region_model->get_store ()->to_json ());
state_obj->set ("constraints",
/* Provide m_checker_states as an object, using names as keys. */
{
- auto checkers_obj = ::make_unique<json::object> ();
+ auto checkers_obj = std::make_unique<json::object> ();
int i;
sm_state_map *smap;
std::unique_ptr<json::value>
symbolic_byte_range::to_json () const
{
- auto obj = ::make_unique<json::object> ();
+ auto obj = std::make_unique<json::object> ();
obj->set ("start", m_start.to_json ());
obj->set ("size", m_size.to_json ());
return obj;
std::unique_ptr<json::object>
region_to_value_map::to_json () const
{
- auto map_obj = ::make_unique<json::object> ();
+ auto map_obj = std::make_unique<json::object> ();
auto_vec<const region *> regs;
for (iterator iter = begin (); iter != end (); ++iter)
std::unique_ptr<json::object>
region_model::to_json () const
{
- auto model_obj = ::make_unique<json::object> ();
+ auto model_obj = std::make_unique<json::object> ();
model_obj->set ("store", m_store.to_json ());
model_obj->set ("constraints", m_constraints->to_json ());
if (m_current_frame)
{
if (reg == m_base_reg_a)
emission_path.add_event
- (make_unique<ptrdiff_region_creation_event> (loc_info, true));
+ (std::make_unique<ptrdiff_region_creation_event> (loc_info, true));
else if (reg == m_base_reg_b)
emission_path.add_event
- (make_unique<ptrdiff_region_creation_event> (loc_info, false));
+ (std::make_unique<ptrdiff_region_creation_event> (loc_info, false));
}
bool
if (base_reg_b->get_kind () == RK_SYMBOLIC)
return;
- ctxt.warn (make_unique<undefined_ptrdiff_diagnostic> (assign,
- sval_a,
- sval_b,
- base_reg_a,
- base_reg_b));
+ ctxt.warn
+ (std::make_unique<undefined_ptrdiff_diagnostic> (assign,
+ sval_a,
+ sval_b,
+ base_reg_a,
+ base_reg_b));
}
/* If ASSIGN is a stmt that can be modelled via
{
if (tree_int_cst_sgn (rhs2_cst) < 0)
ctxt->warn
- (make_unique<shift_count_negative_diagnostic>
+ (std::make_unique<shift_count_negative_diagnostic>
(assign, rhs2_cst));
else if (compare_tree_int (rhs2_cst,
TYPE_PRECISION (TREE_TYPE (rhs1)))
>= 0)
ctxt->warn
- (make_unique<shift_count_overflow_diagnostic>
+ (std::make_unique<shift_count_overflow_diagnostic>
(assign,
int (TYPE_PRECISION (TREE_TYPE (rhs1))),
rhs2_cst));
check_expr = expr;
else
check_expr = NULL;
- if (ctxt->warn (make_unique<poisoned_value_diagnostic> (diag_arg,
- pkind,
- src_region,
- check_expr)))
+ if (ctxt->warn
+ (std::make_unique<poisoned_value_diagnostic> (diag_arg,
+ pkind,
+ src_region,
+ check_expr)))
{
/* We only want to report use of a poisoned value at the first
place it gets used; return an unknown value to avoid generating
};
call_arg_details arg_details (m_cd, m_fmt_param_idx);
- add_note (make_unique<reason_format_attr> (arg_details));
+ add_note (std::make_unique<reason_format_attr> (arg_details));
}
private:
const call_details &m_cd;
}
void add_annotations () final override
{
- add_note (make_unique<reason_attr_access>
- (m_callee_fndecl, m_access));
+ add_note (std::make_unique<reason_attr_access>
+ (m_callee_fndecl, m_access));
}
private:
tree m_callee_fndecl;
const poisoned_svalue *poisoned_sval
= as_a <const poisoned_svalue *> (ptr_sval);
enum poison_kind pkind = poisoned_sval->get_poison_kind ();
- ctxt->warn (::make_unique<poisoned_value_diagnostic>
+ ctxt->warn (std::make_unique<poisoned_value_diagnostic>
(ptr, pkind, nullptr, nullptr));
}
}
{
const function_region *func_reg = as_a <const function_region *> (base_reg);
tree fndecl = func_reg->get_fndecl ();
- ctxt->warn (make_unique<write_to_const_diagnostic>
- (func_reg, fndecl));
+ ctxt->warn
+ (std::make_unique<write_to_const_diagnostic>
+ (func_reg, fndecl));
}
break;
case RK_LABEL:
{
const label_region *label_reg = as_a <const label_region *> (base_reg);
tree label = label_reg->get_label ();
- ctxt->warn (make_unique<write_to_const_diagnostic>
- (label_reg, label));
+ ctxt->warn
+ (std::make_unique<write_to_const_diagnostic>
+ (label_reg, label));
}
break;
case RK_DECL:
"this" param is "T* const"). */
if (TREE_READONLY (decl)
&& is_global_var (decl))
- ctxt->warn (make_unique<write_to_const_diagnostic> (dest_reg, decl));
+ ctxt->warn
+ (std::make_unique<write_to_const_diagnostic> (dest_reg, decl));
}
break;
case RK_STRING:
- ctxt->warn (make_unique<write_to_string_literal_diagnostic> (dest_reg));
+ ctxt->warn
+ (std::make_unique<write_to_string_literal_diagnostic> (dest_reg));
break;
}
}
checker_path &emission_path) final override
{
emission_path.add_event
- (make_unique<region_creation_event_allocation_size> (capacity, loc_info));
+ (std::make_unique<region_creation_event_allocation_size>
+ (capacity, loc_info));
m_has_allocation_event = true;
}
if (TREE_CODE (cst_cap) == INTEGER_CST
&& !capacity_compatible_with_type (cst_cap, pointee_size_tree,
is_struct))
- ctxt->warn (make_unique <dubious_allocation_size> (lhs_reg, rhs_reg,
- capacity, cst_cap,
- ctxt->get_stmt ()));
+ ctxt->warn
+ (std::make_unique <dubious_allocation_size> (lhs_reg, rhs_reg,
+ capacity, cst_cap,
+ ctxt->get_stmt ()));
}
break;
default:
m_constraints))
{
tree expr = get_representative_tree (capacity);
- ctxt->warn (make_unique <dubious_allocation_size> (lhs_reg,
- rhs_reg,
- capacity, expr,
- ctxt->get_stmt ()));
+ ctxt->warn
+ (std::make_unique <dubious_allocation_size> (lhs_reg,
+ rhs_reg,
+ capacity, expr,
+ ctxt->get_stmt ()));
}
}
break;
m_cd.get_model ()->get_current_function ()->decl,
m_cd.get_model ()->get_stack_depth ());
- add_event (make_unique<null_terminator_check_event> (loc_info,
- arg_details));
- add_note (make_unique <null_terminator_check_decl_note> (arg_details));
+ add_event
+ (std::make_unique<null_terminator_check_event> (loc_info,
+ arg_details));
+ add_note
+ (std::make_unique <null_terminator_check_decl_note> (arg_details));
}
private:
const call_details &m_cd;
{
bool sat = add_constraint (lhs, op, rhs, ctxt);
if (!sat && out)
- *out = make_unique <rejected_op_constraint> (*this, lhs, op, rhs);
+ *out = std::make_unique <rejected_op_constraint> (*this, lhs, op, rhs);
return sat;
}
&& !ctxt->possibly_tainted_p (index_sval))
{
if (out)
- *out = make_unique <rejected_default_case> (*this);
+ *out = std::make_unique <rejected_default_case> (*this);
return false;
}
= ranges_mgr->get_or_create_ranges_for_switch (&edge, switch_stmt);
bool sat = m_constraints->add_bounded_ranges (index_sval, all_cases_ranges);
if (!sat && out)
- *out = make_unique <rejected_ranges_constraint> (*this, index, all_cases_ranges);
+ *out = std::make_unique <rejected_ranges_constraint>
+ (*this, index, all_cases_ranges);
if (sat && ctxt && !all_cases_ranges->empty_p ())
ctxt->on_bounded_ranges (*index_sval, *all_cases_ranges);
return sat;
{}
std::unique_ptr<stmt_finder> clone () const override
{
- return ::make_unique<my_finder> (m_call_stmt, m_caller_frame);
+ return std::make_unique<my_finder> (m_call_stmt, m_caller_frame);
}
const gimple *find_stmt (const exploded_path &) override
{
if (const svalue *float_sval = v.get_svalue_to_report ())
{
tree diag_arg = get_representative_tree (float_sval);
- ctxt->warn (make_unique<float_as_size_arg> (diag_arg));
+ ctxt->warn (std::make_unique<float_as_size_arg> (diag_arg));
}
}
tree type = m_copied_sval->get_type ();
if (type && TREE_CODE (type) == RECORD_TYPE)
{
- // (std::make_unique is C++14)
- layout = std::unique_ptr<record_layout> (new record_layout (type));
+ layout = std::make_unique<record_layout> (type);
if (0)
layout->dump ();
{
/* Check for exposure. */
if (contains_uninit_p (copied_sval))
- ctxt->warn (make_unique<exposure_through_uninit_copy> (src_reg,
- dst_reg,
- copied_sval));
+ ctxt->warn
+ (std::make_unique<exposure_through_uninit_copy> (src_reg,
+ dst_reg,
+ copied_sval));
}
/* Set errno to a positive symbolic int, as if some error has occurred. */
#include "digraph.h"
#include "sbitmap.h"
#include "fold-const.h"
-#include "make-unique.h"
#include "analyzer/analyzer-logging.h"
#include "analyzer/supergraph.h"
region::to_json () const
{
label_text desc = get_desc (true);
- auto reg_js = ::make_unique<json::string> (desc.get ());
+ auto reg_js = std::make_unique<json::string> (desc.get ());
return reg_js;
}
{
sm_ctxt.warn (node, stmt, arg,
- make_unique<fd_use_after_close>
+ std::make_unique<fd_use_after_close>
(*this, diag_arg,
fndecl, attr_name,
arg_idx));
if (!is_constant_fd_p (state))
{
sm_ctxt.warn (node, stmt, arg,
- make_unique<fd_use_without_check>
+ std::make_unique<fd_use_without_check>
(*this, diag_arg,
fndecl, attr_name,
arg_idx));
if (is_writeonly_fd_p (state))
{
- sm_ctxt.warn (
- node, stmt, arg,
- make_unique<fd_access_mode_mismatch> (*this, diag_arg,
- DIRS_WRITE,
- fndecl,
- attr_name,
- arg_idx));
+ sm_ctxt.warn
+ (node, stmt, arg,
+ std::make_unique<fd_access_mode_mismatch> (*this, diag_arg,
+ DIRS_WRITE,
+ fndecl,
+ attr_name,
+ arg_idx));
}
break;
if (is_readonly_fd_p (state))
{
- sm_ctxt.warn (
- node, stmt, arg,
- make_unique<fd_access_mode_mismatch> (*this, diag_arg,
- DIRS_READ,
- fndecl,
- attr_name,
- arg_idx));
+ sm_ctxt.warn
+ (node, stmt, arg,
+ std::make_unique<fd_access_mode_mismatch> (*this, diag_arg,
+ DIRS_READ,
+ fndecl,
+ attr_name,
+ arg_idx));
}
break;
else
{
sm_ctxt.warn (node, stmt, NULL_TREE,
- make_unique<fd_leak> (*this, NULL_TREE));
+ std::make_unique<fd_leak> (*this, NULL_TREE));
}
}
sm_ctxt.on_transition (node, stmt, lhs, m_start, m_unchecked_write_only);
else
sm_ctxt.warn (node, stmt, NULL_TREE,
- make_unique<fd_leak> (*this, NULL_TREE));
+ std::make_unique<fd_leak> (*this, NULL_TREE));
}
void
{
sm_ctxt.warn (
node, stmt, arg_2,
- make_unique<fd_use_without_check> (*this, diag_arg_2,
- callee_fndecl));
+ std::make_unique<fd_use_without_check> (*this, diag_arg_2,
+ callee_fndecl));
return;
}
/* dup2 returns value of its second argument on success.But, the
if (is_closed_fd_p (state))
{
sm_ctxt.warn (node, stmt, arg,
- make_unique<fd_double_close> (*this, diag_arg));
+ std::make_unique<fd_double_close> (*this, diag_arg));
sm_ctxt.set_next_state (stmt, arg, m_stop);
}
}
if (is_closed_fd_p (state))
{
sm_ctxt.warn (node, stmt, arg,
- make_unique<fd_use_after_close> (*this, diag_arg,
- callee_fndecl));
+ std::make_unique<fd_use_after_close> (*this, diag_arg,
+ callee_fndecl));
}
else
/* Complain about fncall on socket in wrong phase. */
sm_ctxt.warn
(node, stmt, arg,
- make_unique<fd_phase_mismatch> (*this, diag_arg,
- callee_fndecl,
- state,
- EXPECTED_PHASE_CAN_TRANSFER));
+ std::make_unique<fd_phase_mismatch> (*this, diag_arg,
+ callee_fndecl,
+ state,
+ EXPECTED_PHASE_CAN_TRANSFER));
else if (!(is_valid_fd_p (state)
|| state == m_new_datagram_socket
|| state == m_bound_unknown_socket
if (!is_constant_fd_p (state))
sm_ctxt.warn (
node, stmt, arg,
- make_unique<fd_use_without_check> (*this, diag_arg,
- callee_fndecl));
+ std::make_unique<fd_use_without_check> (*this, diag_arg,
+ callee_fndecl));
}
switch (callee_fndecl_dir)
{
{
tree diag_arg = sm_ctxt.get_diagnostic_tree (arg);
sm_ctxt.warn (node, stmt, arg,
- make_unique<fd_access_mode_mismatch> (
- *this, diag_arg, DIRS_WRITE, callee_fndecl));
+ std::make_unique<fd_access_mode_mismatch>
+ (*this, diag_arg, DIRS_WRITE, callee_fndecl));
}
break;
{
tree diag_arg = sm_ctxt.get_diagnostic_tree (arg);
sm_ctxt.warn (node, stmt, arg,
- make_unique<fd_access_mode_mismatch> (
- *this, diag_arg, DIRS_READ, callee_fndecl));
+ std::make_unique<fd_access_mode_mismatch>
+ (*this, diag_arg, DIRS_READ, callee_fndecl));
}
break;
}
}
else
sm_ctxt.warn (node, &call, NULL_TREE,
- make_unique<fd_leak> (*this, NULL_TREE));
+ std::make_unique<fd_leak> (*this, NULL_TREE));
}
else
{
tree diag_arg = sm_ctxt.get_diagnostic_tree (fd_sval);
sm_ctxt.warn
(node, &call, fd_sval,
- make_unique<fd_use_after_close> (*this, diag_arg,
- cd.get_fndecl_for_call ()));
+ std::make_unique<fd_use_after_close> (*this, diag_arg,
+ cd.get_fndecl_for_call ()));
if (complained)
*complained = true;
if (successful)
tree diag_arg = sm_ctxt.get_diagnostic_tree (fd_sval);
sm_ctxt.warn
(node, &call, fd_sval,
- make_unique<fd_type_mismatch> (*this, diag_arg,
- cd.get_fndecl_for_call (),
- old_state,
- EXPECTED_TYPE_SOCKET));
+ std::make_unique<fd_type_mismatch> (*this, diag_arg,
+ cd.get_fndecl_for_call (),
+ old_state,
+ EXPECTED_TYPE_SOCKET));
if (complained)
*complained = true;
if (successful)
tree diag_arg = sm_ctxt.get_diagnostic_tree (fd_sval);
sm_ctxt.warn
(node, &call, fd_sval,
- make_unique<fd_use_without_check> (*this, diag_arg,
- cd.get_fndecl_for_call ()));
+ std::make_unique<fd_use_without_check> (*this, diag_arg,
+ cd.get_fndecl_for_call ()));
if (complained)
*complained = true;
if (successful)
tree diag_arg = sm_ctxt.get_diagnostic_tree (fd_sval);
sm_ctxt.warn
(node, &cd.get_call_stmt (), fd_sval,
- make_unique<fd_phase_mismatch> (*this, diag_arg,
- cd.get_fndecl_for_call (),
- old_state,
- expected_phase));
+ std::make_unique<fd_phase_mismatch> (*this, diag_arg,
+ cd.get_fndecl_for_call (),
+ old_state,
+ expected_phase));
if (successful)
return false;
}
if (is_stream_socket_fd_p (old_state))
sm_ctxt.warn
(node, &call, fd_sval,
- make_unique<fd_phase_mismatch> (*this, diag_arg,
- cd.get_fndecl_for_call (),
- old_state,
- EXPECTED_PHASE_CAN_LISTEN));
+ std::make_unique<fd_phase_mismatch> (*this, diag_arg,
+ cd.get_fndecl_for_call (),
+ old_state,
+ EXPECTED_PHASE_CAN_LISTEN));
else
sm_ctxt.warn
(node, &call, fd_sval,
- make_unique<fd_type_mismatch> (*this, diag_arg,
- cd.get_fndecl_for_call (),
- old_state,
- EXPECTED_TYPE_STREAM_SOCKET));
+ std::make_unique<fd_type_mismatch> (*this, diag_arg,
+ cd.get_fndecl_for_call (),
+ old_state,
+ EXPECTED_TYPE_STREAM_SOCKET));
if (successful)
return false;
}
if (is_stream_socket_fd_p (old_state))
sm_ctxt.warn
(node, &call, fd_sval,
- make_unique<fd_phase_mismatch> (*this, diag_arg,
- cd.get_fndecl_for_call (),
- old_state,
- EXPECTED_PHASE_CAN_ACCEPT));
+ std::make_unique<fd_phase_mismatch> (*this, diag_arg,
+ cd.get_fndecl_for_call (),
+ old_state,
+ EXPECTED_PHASE_CAN_ACCEPT));
else
sm_ctxt.warn
(node, &call, fd_sval,
- make_unique<fd_type_mismatch> (*this, diag_arg,
- cd.get_fndecl_for_call (),
- old_state,
- EXPECTED_TYPE_STREAM_SOCKET));
+ std::make_unique<fd_type_mismatch> (*this, diag_arg,
+ cd.get_fndecl_for_call (),
+ old_state,
+ EXPECTED_TYPE_STREAM_SOCKET));
if (successful)
return false;
}
}
else
sm_ctxt.warn (node, &call, NULL_TREE,
- make_unique<fd_leak> (*this, NULL_TREE));
+ std::make_unique<fd_leak> (*this, NULL_TREE));
}
else
{
std::unique_ptr<pending_diagnostic>
fd_state_machine::on_leak (tree var) const
{
- return make_unique<fd_leak> (*this, var);
+ return std::make_unique<fd_leak> (*this, var);
}
} // namespace
{
if (cd.get_ctxt ())
{
- cd.get_ctxt ()->bifurcate (make_unique<outcome_of_socket> (cd, false));
- cd.get_ctxt ()->bifurcate (make_unique<outcome_of_socket> (cd, true));
+ cd.get_ctxt ()->bifurcate
+ (std::make_unique<outcome_of_socket> (cd, false));
+ cd.get_ctxt ()->bifurcate
+ (std::make_unique<outcome_of_socket> (cd, true));
cd.get_ctxt ()->terminate_path ();
}
}
{
if (cd.get_ctxt ())
{
- cd.get_ctxt ()->bifurcate (make_unique<outcome_of_bind> (cd, false));
- cd.get_ctxt ()->bifurcate (make_unique<outcome_of_bind> (cd, true));
+ cd.get_ctxt ()->bifurcate
+ (std::make_unique<outcome_of_bind> (cd, false));
+ cd.get_ctxt ()->bifurcate
+ (std::make_unique<outcome_of_bind> (cd, true));
cd.get_ctxt ()->terminate_path ();
}
}
{
if (cd.get_ctxt ())
{
- cd.get_ctxt ()->bifurcate (make_unique<outcome_of_listen> (cd, false));
- cd.get_ctxt ()->bifurcate (make_unique<outcome_of_listen> (cd, true));
+ cd.get_ctxt ()->bifurcate
+ (std::make_unique<outcome_of_listen> (cd, false));
+ cd.get_ctxt ()->bifurcate
+ (std::make_unique<outcome_of_listen> (cd, true));
cd.get_ctxt ()->terminate_path ();
}
}
{
if (cd.get_ctxt ())
{
- cd.get_ctxt ()->bifurcate (make_unique<outcome_of_accept> (cd, false));
- cd.get_ctxt ()->bifurcate (make_unique<outcome_of_accept> (cd, true));
+ cd.get_ctxt ()->bifurcate
+ (std::make_unique<outcome_of_accept> (cd, false));
+ cd.get_ctxt ()->bifurcate
+ (std::make_unique<outcome_of_accept> (cd, true));
cd.get_ctxt ()->terminate_path ();
}
}
{
if (cd.get_ctxt ())
{
- cd.get_ctxt ()->bifurcate (make_unique<outcome_of_connect> (cd, false));
- cd.get_ctxt ()->bifurcate (make_unique<outcome_of_connect> (cd, true));
+ cd.get_ctxt ()->bifurcate
+ (std::make_unique<outcome_of_connect> (cd, false));
+ cd.get_ctxt ()->bifurcate
+ (std::make_unique<outcome_of_connect> (cd, true));
cd.get_ctxt ()->terminate_path ();
}
}
{
if (cd.get_ctxt ())
{
- cd.get_ctxt ()->bifurcate (make_unique<outcome_of_isatty> (cd, false));
- cd.get_ctxt ()->bifurcate (make_unique<outcome_of_isatty> (cd, true));
+ cd.get_ctxt ()->bifurcate
+ (std::make_unique<outcome_of_isatty> (cd, false));
+ cd.get_ctxt ()->bifurcate
+ (std::make_unique<outcome_of_isatty> (cd, true));
cd.get_ctxt ()->terminate_path ();
}
}
{
if (cd.get_ctxt ())
{
- cd.get_ctxt ()->bifurcate (make_unique<failure> (cd));
- cd.get_ctxt ()->bifurcate (make_unique<success> (cd));
+ cd.get_ctxt ()->bifurcate
+ (std::make_unique<failure> (cd));
+ cd.get_ctxt ()->bifurcate
+ (std::make_unique<success> (cd));
cd.get_ctxt ()->terminate_path ();
}
}
void
register_known_fd_functions (known_function_manager &kfm)
{
- kfm.add ("accept", make_unique<kf_accept> ());
- kfm.add ("bind", make_unique<kf_bind> ());
- kfm.add ("connect", make_unique<kf_connect> ());
- kfm.add ("isatty", make_unique<kf_isatty> ());
- kfm.add ("listen", make_unique<kf_listen> ());
- kfm.add ("pipe", make_unique<kf_pipe> (1));
- kfm.add ("pipe2", make_unique<kf_pipe> (2));
- kfm.add ("read", make_unique<kf_read> ());
- kfm.add ("socket", make_unique<kf_socket> ());
+ kfm.add ("accept", std::make_unique<kf_accept> ());
+ kfm.add ("bind", std::make_unique<kf_bind> ());
+ kfm.add ("connect", std::make_unique<kf_connect> ());
+ kfm.add ("isatty", std::make_unique<kf_isatty> ());
+ kfm.add ("listen", std::make_unique<kf_listen> ());
+ kfm.add ("pipe", std::make_unique<kf_pipe> (1));
+ kfm.add ("pipe2", std::make_unique<kf_pipe> (2));
+ kfm.add ("read", std::make_unique<kf_read> ());
+ kfm.add ("socket", std::make_unique<kf_socket> ());
}
} // namespace ana
{
tree diag_arg = sm_ctxt.get_diagnostic_tree (arg);
sm_ctxt.warn (node, stmt, arg,
- make_unique<double_fclose> (*this, diag_arg));
+ std::make_unique<double_fclose> (*this,
+ diag_arg));
sm_ctxt.set_next_state (stmt, arg, m_stop);
}
return true;
std::unique_ptr<pending_diagnostic>
fileptr_state_machine::on_leak (tree var) const
{
- return make_unique<file_leak> (*this, var);
+ return std::make_unique<file_leak> (*this, var);
}
} // anonymous namespace
void
register_known_file_functions (known_function_manager &kfm)
{
- kfm.add (BUILT_IN_FPRINTF, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_FPRINTF_UNLOCKED, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_FPUTC, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_FPUTC_UNLOCKED, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_FPUTS, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_FPUTS_UNLOCKED, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_FWRITE, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_FWRITE_UNLOCKED, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_PRINTF, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_PRINTF_UNLOCKED, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_PUTC, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_PUTCHAR, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_PUTCHAR_UNLOCKED, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_PUTC_UNLOCKED, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_PUTS, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_PUTS_UNLOCKED, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_VFPRINTF, make_unique<kf_stdio_output_fn> ());
- kfm.add (BUILT_IN_VPRINTF, make_unique<kf_stdio_output_fn> ());
-
- kfm.add ("ferror", make_unique<kf_ferror> ());
- kfm.add ("fgets", make_unique<kf_fgets> ());
- kfm.add ("fgets_unlocked", make_unique<kf_fgets> ()); // non-standard
- kfm.add ("fileno", make_unique<kf_fileno> ());
- kfm.add ("fread", make_unique<kf_fread> ());
- kfm.add ("getc", make_unique<kf_getc> ());
- kfm.add ("getchar", make_unique<kf_getchar> ());
+ kfm.add (BUILT_IN_FPRINTF, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_FPRINTF_UNLOCKED, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_FPUTC, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_FPUTC_UNLOCKED, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_FPUTS, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_FPUTS_UNLOCKED, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_FWRITE, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_FWRITE_UNLOCKED, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_PRINTF, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_PRINTF_UNLOCKED, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_PUTC, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_PUTCHAR, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_PUTCHAR_UNLOCKED, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_PUTC_UNLOCKED, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_PUTS, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_PUTS_UNLOCKED, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_VFPRINTF, std::make_unique<kf_stdio_output_fn> ());
+ kfm.add (BUILT_IN_VPRINTF, std::make_unique<kf_stdio_output_fn> ());
+
+ kfm.add ("ferror", std::make_unique<kf_ferror> ());
+ kfm.add ("fgets", std::make_unique<kf_fgets> ());
+ kfm.add ("fgets_unlocked", std::make_unique<kf_fgets> ()); // non-standard
+ kfm.add ("fileno", std::make_unique<kf_fileno> ());
+ kfm.add ("fread", std::make_unique<kf_fread> ());
+ kfm.add ("getc", std::make_unique<kf_getc> ());
+ kfm.add ("getchar", std::make_unique<kf_getchar> ());
/* Some C++ implementations use the std:: copies of these functions
from <cstdio> for <stdio.h>, so we must match against these too. */
- kfm.add_std_ns ("ferror", make_unique<kf_ferror> ());
- kfm.add_std_ns ("fgets", make_unique<kf_fgets> ());
- kfm.add_std_ns ("fread", make_unique<kf_fread> ());
- kfm.add_std_ns ("getc", make_unique<kf_getc> ());
- kfm.add_std_ns ("getchar", make_unique<kf_getchar> ());
+ kfm.add_std_ns ("ferror", std::make_unique<kf_ferror> ());
+ kfm.add_std_ns ("fgets", std::make_unique<kf_fgets> ());
+ kfm.add_std_ns ("fread", std::make_unique<kf_fread> ());
+ kfm.add_std_ns ("getc", std::make_unique<kf_getc> ());
+ kfm.add_std_ns ("getchar", std::make_unique<kf_getchar> ());
}
#if CHECKING_P
if (unchecked_p (state))
{
tree diag_arg = sm_ctxt.get_diagnostic_tree (arg);
- sm_ctxt.warn (node, stmt, arg,
- make_unique<possible_null_arg> (*this, diag_arg, fndecl,
- i));
+ sm_ctxt.warn
+ (node, stmt, arg,
+ std::make_unique<possible_null_arg> (*this, diag_arg, fndecl,
+ i));
const allocation_state *astate
= as_a_allocation_state (state);
sm_ctxt.set_next_state (stmt, arg, astate->get_nonnull ());
{
tree diag_arg = sm_ctxt.get_diagnostic_tree (arg);
sm_ctxt.warn (node, stmt, arg,
- make_unique<null_arg> (*this, diag_arg, fndecl, i));
+ std::make_unique<null_arg> (*this, diag_arg, fndecl, i));
sm_ctxt.set_next_state (stmt, arg, m_stop);
}
else if (state == m_start)
{
tree diag_arg = sm_ctxt.get_diagnostic_tree (arg);
sm_ctxt.warn (node, stmt, arg,
- make_unique<possible_null_deref> (*this,
- diag_arg));
+ std::make_unique<possible_null_deref> (*this,
+ diag_arg));
const allocation_state *astate = as_a_allocation_state (state);
sm_ctxt.set_next_state (stmt, arg, astate->get_nonnull ());
}
{
tree diag_arg = sm_ctxt.get_diagnostic_tree (arg);
sm_ctxt.warn (node, stmt, arg,
- make_unique<null_deref> (*this, diag_arg));
+ std::make_unique<null_deref> (*this, diag_arg));
sm_ctxt.set_next_state (stmt, arg, m_stop);
}
else if (freed_p (state))
tree diag_arg = sm_ctxt.get_diagnostic_tree (arg);
const allocation_state *astate = as_a_allocation_state (state);
sm_ctxt.warn (node, stmt, arg,
- make_unique<use_after_free>
+ std::make_unique<use_after_free>
(*this, diag_arg, astate->m_deallocator));
sm_ctxt.set_next_state (stmt, arg, m_stop);
}
if (diag_ptr)
sm_ctxt.warn
(node, stmt, ptr,
- make_unique<deref_before_check> (*this, diag_ptr));
+ std::make_unique<deref_before_check> (*this, diag_ptr));
sm_ctxt.set_next_state (stmt, ptr, m_stop);
}
freed_reg = old_model->deref_rvalue (ptr_sval, arg, NULL);
}
sm_ctxt.warn (node, &call, arg,
- make_unique<free_of_non_heap>
+ std::make_unique<free_of_non_heap>
(*this, diag_arg, freed_reg, d->m_name));
sm_ctxt.set_next_state (&call, arg, m_stop);
}
/* Wrong allocator. */
tree diag_arg = sm_ctxt.get_diagnostic_tree (arg);
sm_ctxt.warn (node, &call, arg,
- make_unique<mismatching_deallocation>
+ std::make_unique<mismatching_deallocation>
(*this, diag_arg,
astate->m_deallocators,
d));
/* freed -> stop, with warning. */
tree diag_arg = sm_ctxt.get_diagnostic_tree (arg);
sm_ctxt.warn (node, &call, arg,
- make_unique<double_free> (*this, diag_arg, d->m_name));
+ std::make_unique<double_free> (*this, diag_arg, d->m_name));
sm_ctxt.set_next_state (&call, arg, m_stop);
}
else if (state == m_non_heap)
/* Wrong allocator. */
tree diag_arg = sm_ctxt.get_diagnostic_tree (arg);
sm_ctxt.warn (node, &call, arg,
- make_unique<mismatching_deallocation>
+ std::make_unique<mismatching_deallocation>
(*this, diag_arg,
astate->m_deallocators, d));
sm_ctxt.set_next_state (&call, arg, m_stop);
/* freed -> stop, with warning. */
tree diag_arg = sm_ctxt.get_diagnostic_tree (arg);
sm_ctxt.warn (node, &call, arg,
- make_unique<double_free> (*this, diag_arg, "free"));
+ std::make_unique<double_free> (*this, diag_arg, "free"));
sm_ctxt.set_next_state (&call, arg, m_stop);
if (path_context *path_ctxt = sm_ctxt.get_path_context ())
path_ctxt->terminate_path ();
std::unique_ptr<pending_diagnostic>
malloc_state_machine::on_leak (tree var) const
{
- return make_unique<malloc_leak> (*this, var);
+ return std::make_unique<malloc_leak> (*this, var);
}
/* Implementation of state_machine::reset_when_passed_to_unknown_fn_p vfunc
if (tree lhs_expr = sm_ctxt.get_diagnostic_tree (lhs))
{
sm_ctxt.warn (node, stmt, lhs_expr,
- make_unique<pattern_match> (lhs_expr, op, rhs_cst));
+ std::make_unique<pattern_match> (lhs_expr, op, rhs_cst));
}
}
{
tree diag_arg = sm_ctxt.get_diagnostic_tree (arg);
sm_ctxt.warn (node, stmt, arg,
- make_unique<exposure_through_output_file> (*this,
- diag_arg));
+ std::make_unique<exposure_through_output_file> (*this,
+ diag_arg));
}
}
const final override
{
emission_path->add_event
- (make_unique<precanned_custom_event>
- (event_loc_info (UNKNOWN_LOCATION, NULL_TREE, 0),
- "later on,"
- " when the signal is delivered to the process"));
+ (std::make_unique<precanned_custom_event>
+ (event_loc_info (UNKNOWN_LOCATION, NULL_TREE, 0),
+ "later on,"
+ " when the signal is delivered to the process"));
}
};
if (dst_enode)
eg->add_edge (src_enode, dst_enode, NULL, /*state_change (),*/
true, /* assume does work */
- make_unique<signal_delivery_edge_info_t> ());
+ std::make_unique<signal_delivery_edge_info_t> ());
}
const signal_state_machine &m_sm;
if (signal_unsafe_p (callee_fndecl))
if (sm_ctxt.get_global_state () == m_in_signal_handler)
sm_ctxt.warn (node, stmt, NULL_TREE,
- make_unique<signal_unsafe_call>
+ std::make_unique<signal_unsafe_call>
(*this, *call, callee_fndecl));
}
&& sm_ctxt.get_global_state () == m_tainted_control_flow)
{
sm_ctxt.warn (node, call, NULL_TREE,
- make_unique<tainted_assertion> (*this, NULL_TREE,
- callee_fndecl));
+ std::make_unique<tainted_assertion> (*this, NULL_TREE,
+ callee_fndecl));
}
}
// TODO: ...etc; many other sources of untrusted data
TREE_STRING_POINTER (access->to_external_string ());
tree diag_size = sm_ctxt.get_diagnostic_tree (size_arg);
sm_ctxt.warn (node, &call, size_arg,
- make_unique<tainted_access_attrib_size>
+ std::make_unique<tainted_access_attrib_size>
(*this, diag_size, b,
callee_fndecl,
access->sizarg,
return;
tree diag_divisor = sm_ctxt.get_diagnostic_tree (divisor_expr);
- sm_ctxt.warn (node, assign, divisor_expr,
- make_unique <tainted_divisor> (*this, diag_divisor, b));
+ sm_ctxt.warn
+ (node, assign, divisor_expr,
+ std::make_unique <tainted_divisor> (*this, diag_divisor, b));
sm_ctxt.set_next_state (assign, divisor_sval, m_stop);
}
}
if (index_can_be_out_of_bounds_p (element_reg))
{
tree arg = get_representative_tree (index);
- ctxt->warn (make_unique<tainted_array_index> (taint_sm,
- arg, b));
+ ctxt->warn (std::make_unique<tainted_array_index> (taint_sm,
+ arg, b));
}
else if (ctxt->get_logger ())
ctxt->get_logger ()->log ("rejecting tainted_array_index as"
if (taint_sm.get_taint (state, effective_type, &b))
{
tree arg = get_representative_tree (offset);
- ctxt->warn (make_unique<tainted_offset> (taint_sm, arg, b,
- offset));
+ ctxt->warn (std::make_unique<tainted_offset> (taint_sm, arg, b,
+ offset));
}
}
break;
if (taint_sm.get_taint (state, size_sval->get_type (), &b))
{
tree arg = get_representative_tree (size_sval);
- ctxt->warn (make_unique<tainted_size> (taint_sm, arg, b));
+ ctxt->warn (std::make_unique<tainted_size> (taint_sm, arg, b));
}
}
break;
if (taint_sm.get_taint (state, size_in_bytes->get_type (), &b))
{
tree arg = get_representative_tree (size_in_bytes);
- ctxt->warn (make_unique<tainted_allocation_size>
+ ctxt->warn (std::make_unique<tainted_allocation_size>
(taint_sm, arg, size_in_bytes, b, mem_space));
}
}
pretty_printer pp;
pp_format_decoder (&pp) = default_tree_printer;
dump_to_pp (&pp);
- return ::make_unique<json::string> (pp_formatted_text (&pp));
+ return std::make_unique<json::string> (pp_formatted_text (&pp));
}
/* class state_machine. */
std::unique_ptr<json::object>
state_machine::to_json () const
{
- auto sm_obj = ::make_unique<json::object> ();
+ auto sm_obj = std::make_unique<json::object> ();
sm_obj->set_string ("name", m_name);
{
- auto states_arr = ::make_unique<json::array> ();
+ auto states_arr = std::make_unique<json::array> ();
unsigned i;
state *s;
FOR_EACH_VEC_ELT (m_states, i, s)
std::unique_ptr<json::object>
bit_range::to_json () const
{
- auto obj = ::make_unique<json::object> ();
+ auto obj = std::make_unique<json::object> ();
obj->set ("start_bit_offset",
bit_offset_to_json (m_start_bit_offset));
obj->set ("size_in_bits",
std::unique_ptr<json::object>
byte_range::to_json () const
{
- auto obj = ::make_unique<json::object> ();
+ auto obj = std::make_unique<json::object> ();
obj->set ("start_byte_offset",
byte_offset_to_json (m_start_byte_offset));
obj->set ("size_in_bytes",
std::unique_ptr<json::object>
binding_map::to_json () const
{
- auto map_obj = ::make_unique<json::object> ();
+ auto map_obj = std::make_unique<json::object> ();
auto_vec <const binding_key *> binding_keys;
for (map_t::iterator iter = m_map.begin ();
std::unique_ptr<json::object>
binding_cluster::to_json () const
{
- auto cluster_obj = ::make_unique<json::object> ();
+ auto cluster_obj = std::make_unique<json::object> ();
cluster_obj->set_bool ("escaped", m_escaped);
cluster_obj->set_bool ("touched", m_touched);
std::unique_ptr<json::object>
store::to_json () const
{
- auto store_obj = ::make_unique<json::object> ();
+ auto store_obj = std::make_unique<json::object> ();
/* Sort into some deterministic order. */
auto_vec<const region *> base_regions;
{
gcc_assert (parent_reg);
- auto clusters_in_parent_reg_obj = ::make_unique<json::object> ();
+ auto clusters_in_parent_reg_obj = std::make_unique<json::object> ();
const region *base_reg;
unsigned j;
std::unique_ptr<json::object>
supergraph::to_json () const
{
- auto sgraph_obj = ::make_unique<json::object> ();
+ auto sgraph_obj = std::make_unique<json::object> ();
/* Nodes. */
{
- auto nodes_arr = ::make_unique<json::array> ();
+ auto nodes_arr = std::make_unique<json::array> ();
unsigned i;
supernode *n;
FOR_EACH_VEC_ELT (m_nodes, i, n)
/* Edges. */
{
- auto edges_arr = ::make_unique<json::array> ();
+ auto edges_arr = std::make_unique<json::array> ();
unsigned i;
superedge *n;
FOR_EACH_VEC_ELT (m_edges, i, n)
std::unique_ptr<json::object>
supernode::to_json () const
{
- auto snode_obj = ::make_unique<json::object> ();
+ auto snode_obj = std::make_unique<json::object> ();
snode_obj->set_integer ("idx", m_index);
snode_obj->set_integer ("bb_idx", m_bb->index);
/* Phi nodes. */
{
- auto phi_arr = ::make_unique<json::array> ();
+ auto phi_arr = std::make_unique<json::array> ();
for (gphi_iterator gpi = const_cast<supernode *> (this)->start_phis ();
!gsi_end_p (gpi); gsi_next (&gpi))
{
/* Statements. */
{
- auto stmt_arr = ::make_unique<json::array> ();
+ auto stmt_arr = std::make_unique<json::array> ();
int i;
gimple *stmt;
FOR_EACH_VEC_ELT (m_stmts, i, stmt)
std::unique_ptr<json::object>
superedge::to_json () const
{
- auto sedge_obj = ::make_unique<json::object> ();
+ auto sedge_obj = std::make_unique<json::object> ();
sedge_obj->set_string ("kind", edge_kind_to_string (m_kind));
sedge_obj->set_integer ("src_idx", m_src->m_index);
sedge_obj->set_integer ("dst_idx", m_dest->m_index);
#include "fold-const.h"
#include "diagnostic.h"
#include "tree-diagnostic.h"
-#include "make-unique.h"
#include "text-art/dump.h"
#include "analyzer/svalue.h"
#include "analyzer/region-model.h"
-
#if ENABLE_ANALYZER
namespace ana {
svalue::to_json () const
{
label_text desc = get_desc (true);
- auto sval_js = ::make_unique<json::string> (desc.get ());
+ auto sval_js = std::make_unique<json::string> (desc.get ());
return sval_js;
}
{
if (sm_ctxt.get_state (&call, arg) == m_ended)
sm_ctxt.warn (node, &call, arg,
- make_unique<va_list_use_after_va_end>
+ std::make_unique<va_list_use_after_va_end>
(*this, arg, NULL_TREE, usage_fnname));
}
std::unique_ptr<pending_diagnostic>
va_list_state_machine::on_leak (tree var) const
{
- return make_unique<va_list_leak> (*this, nullptr, var);
+ return std::make_unique<va_list_leak> (*this, nullptr, var);
}
} // anonymous namespace
= get_num_variadic_arguments (dst_node->get_function ()->decl,
call_stmt);
emission_path->add_event
- (make_unique<va_arg_call_event>
+ (std::make_unique<va_arg_call_event>
(eedge,
event_loc_info (last_stmt ? last_stmt->location : UNKNOWN_LOCATION,
src_point.get_fndecl (),
else
{
if (ctxt)
- ctxt->warn (make_unique <va_arg_type_mismatch>
+ ctxt->warn (std::make_unique <va_arg_type_mismatch>
(va_list_tree,
arg_reg,
lhs_type,
else
{
if (ctxt)
- ctxt->warn (make_unique <va_list_exhausted> (va_list_tree,
- arg_reg));
+ ctxt->warn
+ (std::make_unique <va_list_exhausted> (va_list_tree,
+ arg_reg));
saw_problem = true;
}
}
void
register_varargs_builtins (known_function_manager &kfm)
{
- kfm.add (BUILT_IN_VA_START, make_unique<kf_va_start> ());
- kfm.add (BUILT_IN_VA_COPY, make_unique<kf_va_copy> ());
- kfm.add (IFN_VA_ARG, make_unique<kf_va_arg> ());
- kfm.add (BUILT_IN_VA_END, make_unique<kf_va_end> ());
+ kfm.add (BUILT_IN_VA_START, std::make_unique<kf_va_start> ());
+ kfm.add (BUILT_IN_VA_COPY, std::make_unique<kf_va_copy> ());
+ kfm.add (IFN_VA_ARG, std::make_unique<kf_va_arg> ());
+ kfm.add (BUILT_IN_VA_END, std::make_unique<kf_va_end> ());
}
} // namespace ana
#include "function.h"
#include "basic-block.h"
#include "gimple.h"
-#include "make-unique.h"
/* The pretty-printer code is primarily designed to closely follow
(GNU) C and C++ grammars. That is to be contrasted with spaghetti
std::unique_ptr<pretty_printer>
c_pretty_printer::clone () const
{
- return ::make_unique<c_pretty_printer> (*this);
+ return std::make_unique<c_pretty_printer> (*this);
}
/* Print the tree T in full, on file FILE. */
#include "omp-offload.h" /* For offload_vars. */
#include "c-parser.h"
#include "gcc-urlifier.h"
-#include "make-unique.h"
#include "tree-pretty-print.h"
if (header_hint)
return name_hint
(nullptr,
- ::make_unique<suggest_missing_header> (loc,
- IDENTIFIER_POINTER (name),
- header_hint));
+ std::make_unique<suggest_missing_header> (loc,
+ IDENTIFIER_POINTER (name),
+ header_hint));
/* Next, look for exact matches for builtin defines that would have been
defined if the user had passed a command-line option (e.g. -fopenmp
if (option_id.m_idx > 0)
return name_hint
(nullptr,
- ::make_unique<suggest_missing_option> (loc,
- IDENTIFIER_POINTER (name),
- option_id));
+ std::make_unique<suggest_missing_option> (loc,
+ IDENTIFIER_POINTER (name),
+ option_id));
/* Only suggest names reserved for the implementation if NAME begins
with an underscore. */
#include "stringpool.h"
#include "attribs.h"
#include "dwarf2.h"
-#include "make-unique.h"
static bool c_tree_printer (pretty_printer *, text_info *, const char *,
int, bool, bool, bool, bool *, pp_token_list &);
void
c_initialize_diagnostics (diagnostic_context *context)
{
- context->set_pretty_printer (::make_unique<c_pretty_printer> ());
+ context->set_pretty_printer (std::make_unique<c_pretty_printer> ());
c_common_diagnostics_set_defaults (context);
context->set_format_decoder (&c_tree_printer);
}
#include "asan.h"
#include "c-family/c-ubsan.h"
#include "gcc-urlifier.h"
-#include "make-unique.h"
/* We need to walk over decls with incomplete struct/union/enum types
after parsing the whole translation unit.
= get_c_stdlib_header_for_string_macro_name (token_name);
if (header_hint != NULL)
h = name_hint (nullptr,
- ::make_unique<suggest_missing_header> (token->location,
- token_name,
- header_hint));
+ std::make_unique<suggest_missing_header>
+ (token->location,
+ token_name,
+ header_hint));
}
c_parse_error (gmsgid,
#include "cp-tree.h"
#include "cxx-pretty-print.h"
#include "tree-pretty-print.h"
-#include "make-unique.h"
static void pp_cxx_unqualified_id (cxx_pretty_printer *, tree);
static void pp_cxx_nested_name_specifier (cxx_pretty_printer *, tree);
std::unique_ptr<pretty_printer>
cxx_pretty_printer::clone () const
{
- return ::make_unique<cxx_pretty_printer> (*this);
+ return std::make_unique<cxx_pretty_printer> (*this);
}
#include "cp-name-hint.h"
#include "attribs.h"
#include "pretty-print-format-impl.h"
-#include "make-unique.h"
#include "diagnostic-format-text.h"
#define pp_separate_with_comma(PP) pp_cxx_separate_with (PP, ',')
#include "c-family/known-headers.h"
#include "c-family/c-spellcheck.h"
#include "bitmap.h"
-#include "make-unique.h"
static cxx_binding *cxx_binding_make (tree value, tree type);
static cp_binding_level *innermost_nonclass_level (void);
/* Clean up CANDIDATES. */
m_candidates.release ();
return name_hint (expr_to_string (candidate),
- ::make_unique<show_candidate_location> (m_loc,
- candidate));
+ std::make_unique<show_candidate_location> (m_loc,
+ candidate));
}
else if (m_candidates.length () > 1)
/* If we have more than one candidate, issue a name_hint without a single
"suggestion", but with a deferred diagnostic that lists the
various candidates. This takes ownership of m_candidates. */
return name_hint (NULL,
- ::make_unique<suggest_alternatives> (m_loc,
- m_candidates));
+ std::make_unique<suggest_alternatives> (m_loc,
+ m_candidates));
/* Otherwise, m_candidates ought to be empty, so no cleanup is necessary. */
gcc_assert (m_candidates.length () == 0);
if (m_limited)
return name_hint
(hint.suggestion (),
- ::make_unique<namespace_limit_reached> (m_loc, m_limit,
- m_name,
- hint.take_deferred ()));
+ std::make_unique<namespace_limit_reached> (m_loc, m_limit,
+ m_name,
+ hint.take_deferred ()));
else
return hint;
}
if (option_id.m_idx > 0)
return name_hint
(nullptr,
- ::make_unique<suggest_missing_option> (location,
- IDENTIFIER_POINTER (name),
- option_id));
+ std::make_unique<suggest_missing_option> (location,
+ IDENTIFIER_POINTER (name),
+ option_id));
/* Otherwise, consider misspellings. */
if (!suggest_misspellings)
return name_hint ();
return name_hint (nullptr,
- ::make_unique<missing_std_header> (location, name_str,
- header_hint));
+ std::make_unique<missing_std_header> (location, name_str,
+ header_hint));
}
/* Attempt to generate a name_hint that suggests a missing header file
if (!linemap_location_before_p (line_table, use_loc, def_loc))
return nullptr;
- return ::make_unique<macro_use_before_def> (use_loc, macro);
+ return std::make_unique<macro_use_before_def> (use_loc, macro);
}
/* Ctor. LOC is the location of the usage. MACRO is the
if (header_hint)
return name_hint
(nullptr,
- ::make_unique<suggest_missing_header> (loc,
- IDENTIFIER_POINTER (name),
- header_hint));
+ std::make_unique<suggest_missing_header> (loc,
+ IDENTIFIER_POINTER (name),
+ header_hint));
best_match <tree, const char *> bm (name);
#include "contracts.h"
#include "bitmap.h"
#include "builtins.h"
-#include "make-unique.h"
\f
/* The lexer. */
if (header_hint != NULL)
h = name_hint
(nullptr,
- ::make_unique<suggest_missing_header> (token->location,
- token_name,
- header_hint));
+ std::make_unique<suggest_missing_header> (token->location,
+ token_name,
+ header_hint));
}
/* Actually emit the error. */
#include "json.h"
#include "selftest.h"
#include "logical-location.h"
-#include "make-unique.h"
class json_output_format;
std::unique_ptr<diagnostic_per_format_buffer>
make_per_format_buffer () final override
{
- return ::make_unique<diagnostic_json_format_buffer> (*this);
+ return std::make_unique<diagnostic_json_format_buffer> (*this);
}
void set_buffer (diagnostic_per_format_buffer *base_buffer) final override
{
bool formatted)
: diagnostic_output_format (context),
m_buffer (nullptr),
- m_toplevel_array (::make_unique<json::array> ()),
+ m_toplevel_array (std::make_unique<json::array> ()),
m_cur_group (nullptr),
m_cur_children_array (nullptr),
m_formatted (formatted)
json_from_expanded_location (diagnostic_context &context, location_t loc)
{
expanded_location exploc = expand_location (loc);
- std::unique_ptr<json::object> result = ::make_unique <json::object> ();
+ std::unique_ptr<json::object> result = std::make_unique <json::object> ();
if (exploc.file)
result->set_string ("file", exploc.file);
result->set_integer ("line", exploc.line);
location_t start_loc = get_start (loc_range->m_loc);
location_t finish_loc = get_finish (loc_range->m_loc);
- std::unique_ptr<json::object> result = ::make_unique <json::object> ();
+ std::unique_ptr<json::object> result = std::make_unique <json::object> ();
result->set ("caret",
json_from_expanded_location (context, caret_loc));
if (start_loc != caret_loc
static std::unique_ptr<json::object>
json_from_fixit_hint (diagnostic_context &context, const fixit_hint *hint)
{
- std::unique_ptr<json::object> fixit_obj = ::make_unique <json::object> ();
+ std::unique_ptr<json::object> fixit_obj = std::make_unique <json::object> ();
location_t start_loc = hint->get_start_loc ();
fixit_obj->set ("start",
static std::unique_ptr<json::object>
json_from_metadata (const diagnostic_metadata *metadata)
{
- std::unique_ptr<json::object> metadata_obj = ::make_unique <json::object> ();
+ std::unique_ptr<json::object> metadata_obj = std::make_unique <json::object> ();
if (metadata->get_cwe ())
metadata_obj->set_integer ("cwe", metadata->get_cwe ());
pretty_printer *ref_pp,
const diagnostic_path *path)
{
- std::unique_ptr<json::array> path_array = ::make_unique<json::array> ();
+ std::unique_ptr<json::array> path_array = std::make_unique<json::array> ();
for (unsigned i = 0; i < path->num_events (); i++)
{
const diagnostic_event &event = path->get_event (i);
- std::unique_ptr<json::object> event_obj = ::make_unique <json::object> ();
+ std::unique_ptr<json::object> event_obj = std::make_unique <json::object> ();
if (event.get_location ())
event_obj->set ("location",
json_from_expanded_location (context,
add a "children" array and record the column origin. */
m_cur_group = diag_obj;
std::unique_ptr<json::array> children_array
- = ::make_unique<json::array> ();
+ = std::make_unique<json::array> ();
m_cur_children_array = children_array.get (); // borrowed
diag_obj->set ("children", std::move (children_array));
diag_obj->set_integer ("column-origin", m_context.m_column_origin);
const rich_location *richloc = diagnostic.richloc;
{
- std::unique_ptr<json::array> loc_array = ::make_unique<json::array> ();
+ std::unique_ptr<json::array> loc_array = std::make_unique<json::array> ();
for (unsigned int i = 0; i < richloc->get_num_locations (); i++)
{
const location_range *loc_range = richloc->get_range (i);
if (richloc->get_num_fixit_hints ())
{
- std::unique_ptr<json::array> fixit_array = ::make_unique<json::array> ();
+ std::unique_ptr<json::array> fixit_array = std::make_unique<json::array> ();
for (unsigned int i = 0; i < richloc->get_num_fixit_hints (); i++)
{
const fixit_hint *hint = richloc->get_fixit_hint (i);
{
diagnostic_output_format_init_json
(context,
- ::make_unique<json_stderr_output_format> (context,
- formatted));
+ std::make_unique<json_stderr_output_format> (context,
+ formatted));
}
/* Populate CONTEXT in preparation for JSON output to a file named
{
diagnostic_output_format_init_json
(context,
- ::make_unique<json_file_output_format> (context,
- formatted,
- base_file_name));
+ std::make_unique<json_file_output_format> (context,
+ formatted,
+ base_file_name));
}
#if CHECKING_P
#include "diagnostic-format-text.h"
#include "ordered-hash-map.h"
#include "sbitmap.h"
-#include "make-unique.h"
#include "selftest.h"
#include "selftest-diagnostic.h"
#include "selftest-diagnostic-show-locus.h"
"%02i:%02i:%02iZ"),
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
- return ::make_unique<json::string> (buf);
+ return std::make_unique<json::string> (buf);
}
/* Subclass of sarif_object for SARIF "invocation" objects
sarif_invocation::sarif_invocation (sarif_builder &builder,
const char * const *original_argv)
-: m_notifications_arr (::make_unique<json::array> ()),
+: m_notifications_arr (std::make_unique<json::array> ()),
m_success (true)
{
// "arguments" property (SARIF v2.1.0 section 3.20.2)
if (original_argv)
{
- auto arguments_arr = ::make_unique<json::array> ();
+ auto arguments_arr = std::make_unique<json::array> ();
for (size_t i = 0; original_argv[i]; ++i)
arguments_arr->append_string (original_argv[i]);
set<json::array> ("arguments", std::move (arguments_arr));
m_success = false;
auto notification
- = ::make_unique<sarif_ice_notification> (diagnostic,
- builder,
- std::move (backtrace));
+ = std::make_unique<sarif_ice_notification> (diagnostic,
+ builder,
+ std::move (backtrace));
/* Support for related locations within a notification was added
in SARIF 2.2; see https://github.com/oasis-tcs/sarif-spec/issues/540 */
{
if (bitmap_empty_p (m_roles))
return;
- auto roles_arr (::make_unique<json::array> ());
+ auto roles_arr (std::make_unique<json::array> ());
for (int i = 0; i < (int)diagnostic_artifact_role::NUM_ROLES; i++)
if (bitmap_bit_p (m_roles, i))
{
sarif_result::on_diagram (const diagnostic_diagram &diagram,
sarif_builder &builder)
{
- auto location_obj = ::make_unique<sarif_location> ();
+ auto location_obj = std::make_unique<sarif_location> ();
auto message_obj = builder.make_message_object_for_diagram (diagram);
location_obj->set<sarif_message> ("message", std::move (message_obj));
/* No existing locationRelationship from THIS to TARGET; make one,
record it, and add it to the "relationships" array. */
auto relationship_obj
- = ::make_unique<sarif_location_relationship> (target, loc_mgr);
+ = std::make_unique<sarif_location_relationship> (target, loc_mgr);
sarif_location_relationship *relationship = relationship_obj.get ();
auto kv
= std::pair<sarif_location *,
m_idx_within_parent (idx_within_parent)
{
/* "threadFlows" property (SARIF v2.1.0 section 3.36.3). */
- auto thread_flows_arr = ::make_unique<json::array> ();
+ auto thread_flows_arr = std::make_unique<json::array> ();
m_thread_flows_arr = thread_flows_arr.get (); // borrowed
set<json::array> ("threadFlows", std::move (thread_flows_arr));
}
unsigned next_thread_flow_idx = m_thread_flows_arr->size ();
auto thread_flow_obj
- = ::make_unique<sarif_thread_flow> (*this, thread, next_thread_flow_idx);
+ = std::make_unique<sarif_thread_flow> (*this, thread, next_thread_flow_idx);
m_thread_id_map.put (thread_id, thread_flow_obj.get ()); // borrowed
sarif_thread_flow *result = thread_flow_obj.get ();
m_thread_flows_arr->append<sarif_thread_flow> (std::move (thread_flow_obj));
m_line_maps (line_maps),
m_token_printer (*this),
m_invocation_obj
- (::make_unique<sarif_invocation> (*this,
- context.get_original_argv ())),
+ (std::make_unique<sarif_invocation> (*this,
+ context.get_original_argv ())),
m_results_array (new json::array ()),
m_cur_group_result (nullptr),
m_seen_any_relative_paths (false),
}
}
- auto frame_obj = ::make_unique<json::object> ();
+ auto frame_obj = std::make_unique<json::object> ();
/* I tried using sarifStack and sarifStackFrame for this
but it's not a good fit e.g. PC information. */
std::unique_ptr<json::object>
sarif_builder::make_stack_from_backtrace ()
{
- auto frames_arr = ::make_unique<json::array> ();
+ auto frames_arr = std::make_unique<json::array> ();
backtrace_state *state = nullptr;
state = backtrace_create_state (nullptr, 0, nullptr, nullptr);
if (frames_arr->size () == 0)
return nullptr;
- auto stack = ::make_unique<json::object> ();
+ auto stack = std::make_unique<json::object> ();
stack->set ("frames", std::move (frames_arr));
return stack;
}
diagnostic_t orig_diag_kind,
unsigned idx_within_parent)
{
- auto result_obj = ::make_unique<sarif_result> (idx_within_parent);
+ auto result_obj = std::make_unique<sarif_result> (idx_within_parent);
/* "ruleId" property (SARIF v2.1.0 section 3.27.5). */
/* Ideally we'd have an option_name for these. */
/* "taxa" property (SARIF v2.1.0 section 3.27.8). */
if (int cwe_id = diagnostic.metadata->get_cwe ())
{
- auto taxa_arr = ::make_unique<json::array> ();
+ auto taxa_arr = std::make_unique<json::array> ();
taxa_arr->append<sarif_reporting_descriptor_reference>
(make_reporting_descriptor_reference_object_for_cwe_id (cwe_id));
result_obj->set<json::array> ("taxa", std::move (taxa_arr));
/* "codeFlows" property (SARIF v2.1.0 section 3.27.18). */
if (const diagnostic_path *path = diagnostic.richloc->get_path ())
{
- auto code_flows_arr = ::make_unique<json::array> ();
+ auto code_flows_arr = std::make_unique<json::array> ();
const unsigned code_flow_index = 0;
code_flows_arr->append<sarif_code_flow>
(make_code_flow_object (*result_obj.get (),
const rich_location *richloc = diagnostic.richloc;
if (richloc->get_num_fixit_hints ())
{
- auto fix_arr = ::make_unique<json::array> ();
+ auto fix_arr = std::make_unique<json::array> ();
fix_arr->append<sarif_fix> (make_fix_object (*richloc));
result_obj->set<json::array> ("fixes", std::move (fix_arr));
}
diagnostic_t /*orig_diag_kind*/,
const char *option_text)
{
- auto reporting_desc = ::make_unique<sarif_reporting_descriptor> ();
+ auto reporting_desc = std::make_unique<sarif_reporting_descriptor> ();
/* "id" property (SARIF v2.1.0 section 3.49.3). */
reporting_desc->set_string ("id", option_text);
std::unique_ptr<sarif_reporting_descriptor>
sarif_builder::make_reporting_descriptor_object_for_cwe_id (int cwe_id) const
{
- auto reporting_desc = ::make_unique<sarif_reporting_descriptor> ();
+ auto reporting_desc = std::make_unique<sarif_reporting_descriptor> ();
/* "id" property (SARIF v2.1.0 section 3.49.3). */
{
sarif_builder::
make_reporting_descriptor_reference_object_for_cwe_id (int cwe_id)
{
- auto desc_ref_obj = ::make_unique<sarif_reporting_descriptor_reference> ();
+ auto desc_ref_obj = std::make_unique<sarif_reporting_descriptor_reference> ();
/* "id" property (SARIF v2.1.0 section 3.52.4). */
{
sarif_builder::
make_tool_component_reference_object_for_cwe () const
{
- auto comp_ref_obj = ::make_unique<sarif_tool_component_reference> ();
+ auto comp_ref_obj = std::make_unique<sarif_tool_component_reference> ();
/* "name" property (SARIF v2.1.0 section 3.54.3). */
comp_ref_obj->set_string ("name", "cwe");
const diagnostic_info &diagnostic,
enum diagnostic_artifact_role role)
{
- auto locations_arr = ::make_unique<json::array> ();
+ auto locations_arr = std::make_unique<json::array> ();
const logical_location *logical_loc = nullptr;
if (auto client_data_hooks = m_context.get_client_data_hooks ())
logical_loc = client_data_hooks->get_current_logical_location ();
{
if (!logical_loc)
return;
- auto location_locs_arr = ::make_unique<json::array> ();
+ auto location_locs_arr = std::make_unique<json::array> ();
location_locs_arr->append<sarif_logical_location>
(make_sarif_logical_location_object (*logical_loc));
location_obj.set<json::array> ("logicalLocations",
} the_renderer (rich_loc,
m_context.get_escape_format ());
- auto location_obj = ::make_unique<sarif_location> ();
+ auto location_obj = std::make_unique<sarif_location> ();
/* Get primary loc from RICH_LOC. */
location_t loc = rich_loc.get_loc ();
if (region)
{
if (!annotations_arr)
- annotations_arr = ::make_unique<json::array> ();
+ annotations_arr = std::make_unique<json::array> ();
region->set<sarif_message>
("message", make_message_object (text.get ()));
annotations_arr->append<sarif_region> (std::move (region));
location_t loc,
enum diagnostic_artifact_role role)
{
- auto location_obj = ::make_unique<sarif_location> ();
+ auto location_obj = std::make_unique<sarif_location> ();
/* "physicalLocation" property (SARIF v2.1.0 section 3.28.3). */
if (auto phs_loc_obj
const diagnostic_event &event,
enum diagnostic_artifact_role role)
{
- auto location_obj = ::make_unique<sarif_location> ();
+ auto location_obj = std::make_unique<sarif_location> ();
/* "physicalLocation" property (SARIF v2.1.0 section 3.28.3). */
location_t loc = event.get_location ();
if (loc <= BUILTINS_LOCATION || LOCATION_FILE (loc) == nullptr)
return nullptr;
- auto phys_loc_obj = ::make_unique<sarif_physical_location> ();
+ auto phys_loc_obj = std::make_unique<sarif_physical_location> ();
/* "artifactLocation" property (SARIF v2.1.0 section 3.29.3). */
phys_loc_obj->set<sarif_artifact_location>
std::unique_ptr<sarif_artifact_location>
sarif_builder::make_artifact_location_object (const char *filename)
{
- auto artifact_loc_obj = ::make_unique<sarif_artifact_location> ();
+ auto artifact_loc_obj = std::make_unique<sarif_artifact_location> ();
/* "uri" property (SARIF v2.1.0 section 3.4.3). */
artifact_loc_obj->set_string ("uri", filename);
std::unique_ptr<sarif_artifact_location>
sarif_builder::make_artifact_location_object_for_pwd () const
{
- auto artifact_loc_obj = ::make_unique<sarif_artifact_location> ();
+ auto artifact_loc_obj = std::make_unique<sarif_artifact_location> ();
/* "uri" property (SARIF v2.1.0 section 3.4.3). */
if (char *pwd = make_pwd_uri_str ())
if (exploc_start.line <= 0)
return nullptr;
- auto region_obj = ::make_unique<sarif_region> ();
+ auto region_obj = std::make_unique<sarif_region> ();
/* "startLine" property (SARIF v2.1.0 section 3.30.5) */
region_obj->set_integer ("startLine", exploc_start.line);
if (exploc_start.line <= 0)
return nullptr;
- auto region_obj = ::make_unique<sarif_region> ();
+ auto region_obj = std::make_unique<sarif_region> ();
/* "startLine" property (SARIF v2.1.0 section 3.30.5) */
region_obj->set_integer ("startLine", exploc_start.line);
expanded_location exploc_start = expand_location (start_loc);
expanded_location exploc_next = expand_location (next_loc);
- auto region_obj = ::make_unique<sarif_region> ();
+ auto region_obj = std::make_unique<sarif_region> ();
/* "startLine" property (SARIF v2.1.0 section 3.30.5) */
region_obj->set_integer ("startLine", exploc_start.line);
std::unique_ptr<sarif_logical_location>
make_sarif_logical_location_object (const logical_location &logical_loc)
{
- auto logical_loc_obj = ::make_unique<sarif_logical_location> ();
+ auto logical_loc_obj = std::make_unique<sarif_logical_location> ();
/* "name" property (SARIF v2.1.0 section 3.33.4). */
if (const char *short_name = logical_loc.get_short_name ())
const diagnostic_path &path)
{
auto code_flow_obj
- = ::make_unique <sarif_code_flow> (result, idx_within_parent);
+ = std::make_unique <sarif_code_flow> (result, idx_within_parent);
/* First pass:
Create threadFlows and threadFlowLocation objects within them,
&& m.m_property == diagnostic_event::PROPERTY_unknown)
return nullptr;
- auto kinds_arr = ::make_unique<json::array> ();
+ auto kinds_arr = std::make_unique<json::array> ();
if (const char *verb_str
= diagnostic_event::meaning::maybe_get_verb_str (m.m_verb))
kinds_arr->append_string (verb_str);
std::unique_ptr<sarif_message>
sarif_builder::make_message_object (const char *msg) const
{
- auto message_obj = ::make_unique<sarif_message> ();
+ auto message_obj = std::make_unique<sarif_message> ();
/* "text" property (SARIF v2.1.0 section 3.11.8). */
set_string_property_escaping_braces (*message_obj,
std::unique_ptr<sarif_message>
sarif_builder::make_message_object_for_diagram (const diagnostic_diagram &diagram)
{
- auto message_obj = ::make_unique<sarif_message> ();
+ auto message_obj = std::make_unique<sarif_message> ();
/* "text" property (SARIF v2.1.0 section 3.11.8). */
set_string_property_escaping_braces (*message_obj,
std::unique_ptr<sarif_multiformat_message_string>
sarif_builder::make_multiformat_message_string (const char *msg) const
{
- auto message_obj = ::make_unique<sarif_multiformat_message_string> ();
+ auto message_obj = std::make_unique<sarif_multiformat_message_string> ();
/* "text" property (SARIF v2.1.0 section 3.12.3). */
set_string_property_escaping_braces (*message_obj,
make_top_level_object (std::unique_ptr<sarif_invocation> invocation_obj,
std::unique_ptr<json::array> results)
{
- auto log_obj = ::make_unique<sarif_log> ();
+ auto log_obj = std::make_unique<sarif_log> ();
/* "$schema" property (SARIF v2.1.0 section 3.13.3) . */
log_obj->set_string ("$schema", sarif_version_to_url (get_version ()));
log_obj->set_string ("version", sarif_version_to_property (get_version ()));
/* "runs" property (SARIF v2.1.0 section 3.13.4). */
- auto run_arr = ::make_unique<json::array> ();
+ auto run_arr = std::make_unique<json::array> ();
auto run_obj = make_run_object (std::move (invocation_obj),
std::move (results));
run_arr->append<sarif_run> (std::move (run_obj));
make_run_object (std::unique_ptr<sarif_invocation> invocation_obj,
std::unique_ptr<json::array> results)
{
- auto run_obj = ::make_unique<sarif_run> ();
+ auto run_obj = std::make_unique<sarif_run> ();
/* "tool" property (SARIF v2.1.0 section 3.14.6). */
run_obj->set<sarif_tool> ("tool", make_tool_object ());
/* "invocations" property (SARIF v2.1.0 section 3.14.11). */
{
- auto invocations_arr = ::make_unique<json::array> ();
+ auto invocations_arr = std::make_unique<json::array> ();
invocations_arr->append (std::move (invocation_obj));
run_obj->set<json::array> ("invocations", std::move (invocations_arr));
}
/* "originalUriBaseIds (SARIF v2.1.0 section 3.14.14). */
if (m_seen_any_relative_paths)
{
- auto orig_uri_base_ids = ::make_unique<json::object> ();
+ auto orig_uri_base_ids = std::make_unique<json::object> ();
orig_uri_base_ids->set<sarif_artifact_location>
(PWD_PROPERTY_NAME, make_artifact_location_object_for_pwd ());
run_obj->set<json::object> ("originalUriBaseIds",
}
/* "artifacts" property (SARIF v2.1.0 section 3.14.15). */
- auto artifacts_arr = ::make_unique<json::array> ();
+ auto artifacts_arr = std::make_unique<json::array> ();
for (auto iter : m_filename_to_artifact_map)
{
sarif_artifact *artifact_obj = iter.second;
std::unique_ptr<sarif_tool>
sarif_builder::make_tool_object ()
{
- auto tool_obj = ::make_unique<sarif_tool> ();
+ auto tool_obj = std::make_unique<sarif_tool> ();
/* "driver" property (SARIF v2.1.0 section 3.18.2). */
tool_obj->set<sarif_tool_component> ("driver",
{
/* Create a "toolComponent" object (SARIF v2.1.0 section 3.19)
for the plugin. */
- auto plugin_obj = ::make_unique<sarif_tool_component> ();
+ auto plugin_obj = std::make_unique<sarif_tool_component> ();
/* "name" property (SARIF v2.1.0 section 3.19.8). */
if (const char *short_name = p.get_short_name ())
vinfo->for_each_plugin (v);
if (v.m_plugin_objs.size () > 0)
{
- auto extensions_arr = ::make_unique<json::array> ();
+ auto extensions_arr = std::make_unique<json::array> ();
for (auto &iter : v.m_plugin_objs)
extensions_arr->append<sarif_tool_component> (std::move (iter));
tool_obj->set<json::array> ("extensions",
std::unique_ptr<sarif_tool_component>
sarif_builder::make_driver_tool_component_object ()
{
- auto driver_obj = ::make_unique<sarif_tool_component> ();
+ auto driver_obj = std::make_unique<sarif_tool_component> ();
if (auto client_data_hooks = m_context.get_client_data_hooks ())
if (const client_version_info *vinfo
return nullptr;
/* "taxonomies" property (SARIF v2.1.0 section 3.14.8). */
- auto taxonomies_arr = ::make_unique<json::array> ();
+ auto taxonomies_arr = std::make_unique<json::array> ();
taxonomies_arr->append<sarif_tool_component> (std::move (cwe_obj));
return taxonomies_arr;
}
if (m_cwe_id_set.is_empty ())
return nullptr;
- auto taxonomy_obj = ::make_unique<sarif_tool_component> ();
+ auto taxonomy_obj = std::make_unique<sarif_tool_component> ();
/* "name" property (SARIF v2.1.0 section 3.19.8). */
taxonomy_obj->set_string ("name", "CWE");
" Common Weakness Enumeration"));
/* "taxa" property (SARIF v2.1.0 3.section 3.19.25). */
- auto taxa_arr = ::make_unique<json::array> ();
+ auto taxa_arr = std::make_unique<json::array> ();
for (auto cwe_id : m_cwe_id_set)
taxa_arr->append<sarif_reporting_descriptor>
(make_reporting_descriptor_object_for_cwe_id (cwe_id));
if (!cpp_valid_utf8_p(utf8_content.get_buffer (), utf8_content.length ()))
return nullptr;
- auto artifact_content_obj = ::make_unique<sarif_artifact_content> ();
+ auto artifact_content_obj = std::make_unique<sarif_artifact_content> ();
artifact_content_obj->set<json::string>
("text",
- ::make_unique <json::string> (utf8_content.get_buffer (),
+ std::make_unique <json::string> (utf8_content.get_buffer (),
utf8_content.length ()));
return artifact_content_obj;
}
return nullptr;
}
- auto artifact_content_obj = ::make_unique<sarif_artifact_content> ();
+ auto artifact_content_obj = std::make_unique<sarif_artifact_content> ();
artifact_content_obj->set_string ("text", text_utf8);
free (text_utf8);
std::unique_ptr<sarif_fix>
sarif_builder::make_fix_object (const rich_location &richloc)
{
- auto fix_obj = ::make_unique<sarif_fix> ();
+ auto fix_obj = std::make_unique<sarif_fix> ();
/* "artifactChanges" property (SARIF v2.1.0 section 3.55.3). */
/* We assume that all fix-it hints in RICHLOC affect the same file. */
- auto artifact_change_arr = ::make_unique<json::array> ();
+ auto artifact_change_arr = std::make_unique<json::array> ();
artifact_change_arr->append<sarif_artifact_change>
(make_artifact_change_object (richloc));
fix_obj->set<json::array> ("artifactChanges",
std::unique_ptr<sarif_artifact_change>
sarif_builder::make_artifact_change_object (const rich_location &richloc)
{
- auto artifact_change_obj = ::make_unique<sarif_artifact_change> ();
+ auto artifact_change_obj = std::make_unique<sarif_artifact_change> ();
/* "artifactLocation" property (SARIF v2.1.0 section 3.56.2). */
artifact_change_obj->set<sarif_artifact_location>
make_artifact_location_object (richloc.get_loc ()));
/* "replacements" property (SARIF v2.1.0 section 3.56.3). */
- auto replacement_arr = ::make_unique<json::array> ();
+ auto replacement_arr = std::make_unique<json::array> ();
for (unsigned int i = 0; i < richloc.get_num_fixit_hints (); i++)
{
const fixit_hint *hint = richloc.get_fixit_hint (i);
std::unique_ptr<sarif_replacement>
sarif_builder::make_replacement_object (const fixit_hint &hint) const
{
- auto replacement_obj = ::make_unique<sarif_replacement> ();
+ auto replacement_obj = std::make_unique<sarif_replacement> ();
/* "deletedRegion" property (SARIF v2.1.0 section 3.57.3). */
replacement_obj->set<sarif_region> ("deletedRegion",
std::unique_ptr<sarif_artifact_content>
sarif_builder::make_artifact_content_object (const char *text) const
{
- auto content_obj = ::make_unique<sarif_artifact_content> ();
+ auto content_obj = std::make_unique<sarif_artifact_content> ();
/* "text" property (SARIF v2.1.0 section 3.3.2). */
content_obj->set_string ("text", text);
std::unique_ptr<diagnostic_per_format_buffer>
make_per_format_buffer () final override
{
- return ::make_unique<diagnostic_sarif_format_buffer> (m_builder);
+ return std::make_unique<diagnostic_sarif_format_buffer> (m_builder);
}
void set_buffer (diagnostic_per_format_buffer *base_buffer) final override
{
const sarif_generation_options sarif_gen_opts;
diagnostic_output_format_init_sarif
(context,
- ::make_unique<sarif_stream_output_format> (context,
- line_maps,
- main_input_filename_,
- formatted,
- sarif_gen_opts,
- stderr));
+ std::make_unique<sarif_stream_output_format> (context,
+ line_maps,
+ main_input_filename_,
+ formatted,
+ sarif_gen_opts,
+ stderr));
}
/* Attempt to open BASE_FILE_NAME.sarif for writing.
const sarif_generation_options sarif_gen_opts;
diagnostic_output_format_init_sarif
(context,
- ::make_unique<sarif_file_output_format> (context,
- line_maps,
- main_input_filename_,
- formatted,
- sarif_gen_opts,
- std::move (output_file)));
+ std::make_unique<sarif_file_output_format> (context,
+ line_maps,
+ main_input_filename_,
+ formatted,
+ sarif_gen_opts,
+ std::move (output_file)));
}
/* Populate CONTEXT in preparation for SARIF output to STREAM. */
const sarif_generation_options sarif_gen_opts;
diagnostic_output_format_init_sarif
(context,
- ::make_unique<sarif_stream_output_format> (context,
- line_maps,
- main_input_filename_,
- formatted,
- sarif_gen_opts,
- stream));
+ std::make_unique<sarif_stream_output_format> (context,
+ line_maps,
+ main_input_filename_,
+ formatted,
+ sarif_gen_opts,
+ stream));
}
std::unique_ptr<diagnostic_output_format>
const sarif_generation_options &sarif_gen_opts,
diagnostic_output_file output_file)
{
- auto sink = ::make_unique<sarif_file_output_format> (context,
- &line_maps,
- main_input_filename_,
- formatted,
- sarif_gen_opts,
- std::move (output_file));
+ auto sink
+ = std::make_unique<sarif_file_output_format> (context,
+ &line_maps,
+ main_input_filename_,
+ formatted,
+ sarif_gen_opts,
+ std::move (output_file));
sink->update_printer ();
return sink;
}
test_sarif_diagnostic_context (const char *main_input_filename,
const sarif_generation_options &sarif_gen_opts)
{
- auto format = ::make_unique<buffered_output_format> (*this,
- line_table,
- main_input_filename,
- true,
- sarif_gen_opts);
+ auto format = std::make_unique<buffered_output_format> (*this,
+ line_table,
+ main_input_filename,
+ true,
+ sarif_gen_opts);
m_format = format.get (); // borrowed
diagnostic_output_format_init_sarif (*this, std::move (format));
}
};
test_sarif_diagnostic_context dc ("test.c", sarif_gen_opts);
- dc.push_owned_urlifier (::make_unique<test_urlifier> ());
+ dc.push_owned_urlifier (std::make_unique<test_urlifier> ());
rich_location richloc (line_table, UNKNOWN_LOCATION);
dc.report (DK_ERROR, richloc, nullptr, 0,
"foo %<-foption%> %<unrecognized%> bar");
#include "diagnostic-format-text.h"
#include "diagnostic-buffer.h"
#include "text-art/theme.h"
-#include "make-unique.h"
/* Disable warnings about quoting issues in the pp_xxx calls below
that (intentionally) don't follow GCC diagnostic conventions. */
std::unique_ptr<diagnostic_per_format_buffer>
diagnostic_text_output_format::make_per_format_buffer ()
{
- return ::make_unique<diagnostic_text_format_buffer> (*this);
+ return std::make_unique<diagnostic_text_format_buffer> (*this);
}
/* Implementation of diagnostic_output_format::on_report_diagnostic vfunc
#include "pretty-print-urlifier.h"
#include "logical-location.h"
#include "diagnostic-buffer.h"
-#include "make-unique.h"
#ifdef HAVE_TERMIOS_H
# include <termios.h>
{
/* Allocate a basic pretty-printer. Clients will replace this a
much more elaborated pretty-printer if they wish. */
- m_reference_printer = ::make_unique<pretty_printer> ().release ();
+ m_reference_printer = std::make_unique<pretty_printer> ().release ();
m_file_cache = new file_cache ();
m_diagnostic_counters.clear ();
#include "optinfo-emit-json.h"
#include "stringpool.h" /* for get_identifier. */
#include "spellcheck.h"
-#include "make-unique.h"
#include "pretty-print-format-impl.h"
/* If non-NULL, return one past-the-end of the matching SUBPART of
pp_newline (&pp);
std::unique_ptr<optinfo_item> item
- = make_unique<optinfo_item> (OPTINFO_ITEM_KIND_GIMPLE,
- gimple_location (stmt),
- xstrdup (pp_formatted_text (&pp)));
+ = std::make_unique<optinfo_item> (OPTINFO_ITEM_KIND_GIMPLE,
+ gimple_location (stmt),
+ xstrdup (pp_formatted_text (&pp)));
return item;
}
pp_gimple_stmt_1 (&pp, stmt, spc, dump_flags);
std::unique_ptr<optinfo_item> item
- = make_unique<optinfo_item> (OPTINFO_ITEM_KIND_GIMPLE,
- gimple_location (stmt),
- xstrdup (pp_formatted_text (&pp)));
+ = std::make_unique<optinfo_item> (OPTINFO_ITEM_KIND_GIMPLE,
+ gimple_location (stmt),
+ xstrdup (pp_formatted_text (&pp)));
return item;
}
loc = EXPR_LOCATION (node);
std::unique_ptr<optinfo_item> item
- = make_unique<optinfo_item> (OPTINFO_ITEM_KIND_TREE, loc,
- xstrdup (pp_formatted_text (&pp)));
+ = std::make_unique<optinfo_item> (OPTINFO_ITEM_KIND_TREE, loc,
+ xstrdup (pp_formatted_text (&pp)));
return item;
}
{
location_t loc = DECL_SOURCE_LOCATION (node->decl);
std::unique_ptr<optinfo_item> item
- = make_unique<optinfo_item> (OPTINFO_ITEM_KIND_SYMTAB_NODE, loc,
- xstrdup (node->dump_name ()));
+ = std::make_unique<optinfo_item> (OPTINFO_ITEM_KIND_SYMTAB_NODE, loc,
+ xstrdup (node->dump_name ()));
return item;
}
gcc_assert (item.get ());
auto custom_data
- = ::make_unique<wrapped_optinfo_item> (std::move (item));
+ = std::make_unique<wrapped_optinfo_item> (std::move (item));
formatted_tok_list.push_back<pp_token_custom_data> (std::move (custom_data));
}
char *formatted_text = xstrdup (pp_formatted_text (pp));
std::unique_ptr<optinfo_item> item
- = make_unique<optinfo_item> (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION,
- formatted_text);
+ = std::make_unique<optinfo_item> (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION,
+ formatted_text);
pp->emit_item (std::move (item), m_optinfo);
/* Clear the pending text by unwinding formatted_text back to the start
}
auto item
- = make_unique<optinfo_item> (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION,
- xstrdup (pp_formatted_text (&pp)));
+ = std::make_unique<optinfo_item> (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION,
+ xstrdup (pp_formatted_text (&pp)));
return item;
}
pp_printf (&pp, "%s %s %s", "===", name, "===");
pp_newline (&pp);
std::unique_ptr<optinfo_item> item
- = make_unique<optinfo_item> (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION,
- xstrdup (pp_formatted_text (&pp)));
+ = std::make_unique<optinfo_item> (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION,
+ xstrdup (pp_formatted_text (&pp)));
emit_item (*item.get (), MSG_NOTE);
if (optinfo_enabled_p ())
#include "options.h"
#include "diagnostic.h"
#include "selftest.h"
-#include "make-unique.h"
#include "target.h"
/* class attribute_urlifier : public urlifier. */
#include "options.h"
#include "diagnostic.h"
#include "selftest.h"
-#include "make-unique.h"
char *
make_doc_url (const char *doc_url_suffix)
std::unique_ptr<urlifier>
make_gcc_urlifier (unsigned int lang_mask)
{
- return ::make_unique<gcc_urlifier> (lang_mask);
+ return std::make_unique<gcc_urlifier> (lang_mask);
}
/* class auto_override_urlifier. */
#include "cgraph.h"
#include "target.h"
#include "diagnostic-format-text.h"
-#include "make-unique.h"
#include "print-tree.h"
#include <mpfr.h>
diagnostic_text_starter (global_dc) = jit_begin_diagnostic;
diagnostic_text_finalizer (global_dc) = jit_end_diagnostic;
auto sink
- = ::make_unique<jit_diagnostic_listener> (*global_dc,
- *gcc::jit::active_playback_ctxt);
+ = std::make_unique<jit_diagnostic_listener>
+ (*global_dc,
+ *gcc::jit::active_playback_ctxt);
global_dc->set_output_format (std::move (sink));
build_common_tree_nodes (flag_signed_char);
#include "json-parsing.h"
#include "pretty-print.h"
#include "math.h"
-#include "make-unique.h"
#include "selftest.h"
using namespace json;
location_map::range r;
r.m_start = p;
r.m_end = p;
- return ::make_unique<error> (r, xstrdup (msg));
+ return std::make_unique<error> (r, xstrdup (msg));
}
/* parser's ctor. */
case TOK_STRING:
{
- auto val = ::make_unique<string> (tok->u.string);
+ auto val = std::make_unique<string> (tok->u.string);
m_lexer.consume ();
maybe_record_range (val.get (), tok->range);
return parser_result_t (std::move (val));
case TOK_FLOAT_NUMBER:
{
- auto val = ::make_unique<float_number> (tok->u.float_number);
+ auto val = std::make_unique<float_number> (tok->u.float_number);
m_lexer.consume ();
maybe_record_range (val.get (), tok->range);
return parser_result_t (std::move (val));
case TOK_INTEGER_NUMBER:
{
- auto val = ::make_unique<integer_number> (tok->u.integer_number);
+ auto val = std::make_unique<integer_number> (tok->u.integer_number);
m_lexer.consume ();
maybe_record_range (val.get (), tok->range);
return parser_result_t (std::move (val));
case TOK_TRUE:
{
- auto val = ::make_unique<literal> (JSON_TRUE);
+ auto val = std::make_unique<literal> (JSON_TRUE);
m_lexer.consume ();
maybe_record_range (val.get (), tok->range);
return parser_result_t (std::move (val));
case TOK_FALSE:
{
- auto val = ::make_unique<literal> (JSON_FALSE);
+ auto val = std::make_unique<literal> (JSON_FALSE);
m_lexer.consume ();
maybe_record_range (val.get (), tok->range);
return parser_result_t (std::move (val));
case TOK_NULL:
{
- auto val = ::make_unique<literal> (JSON_NULL);
+ auto val = std::make_unique<literal> (JSON_NULL);
m_lexer.consume ();
maybe_record_range (val.get (), tok->range);
return parser_result_t (std::move (val));
require (TOK_OPEN_CURLY);
- auto obj = ::make_unique<object> ();
+ auto obj = std::make_unique<object> ();
const token *tok = m_lexer.peek ();
if (tok->id == TOK_CLOSE_CURLY)
if (auto err = require (TOK_OPEN_SQUARE))
return parser_result_t (std::move (err));
- auto arr = ::make_unique<array> ();
+ auto arr = std::make_unique<array> ();
const token *tok = m_lexer.peek ();
if (tok->id == TOK_CLOSE_SQUARE)
char *formatted_msg = xvasprintf (fmt, ap);
va_end (ap);
- return ::make_unique<error> (r, formatted_msg);
+ return std::make_unique<error> (r, formatted_msg);
}
/* Record that JV has range R within the input file. */
#include "json.h"
#include "pretty-print.h"
#include "math.h"
-#include "make-unique.h"
#include "selftest.h"
using namespace json;
{
object obj;
object *child = new object;
- std::unique_ptr<object> grandchild = ::make_unique<object> ();
+ std::unique_ptr<object> grandchild = std::make_unique<object> ();
obj.set_string ("str", "bar");
obj.set ("child", child);
array *arr = new array;
for (int i = 0; i < 3; i++)
- arr->append (::make_unique<integer_number> (i));
+ arr->append (std::make_unique<integer_number> (i));
grandchild->set ("arr", arr);
grandchild->set_integer ("int", 1066);
#include "intl.h"
#include "diagnostic.h"
#include "lazy-diagnostic-path.h"
-#include "make-unique.h"
#include "selftest.h"
#include "selftest-diagnostic.h"
#include "simple-diagnostic-path.h"
tree fntype_void_void
= build_function_type_array (void_type_node, 0, NULL);
tree fndecl_foo = build_fn_decl ("foo", fntype_void_void);
- auto path = ::make_unique<simple_diagnostic_path> (&m_pp);
+ auto path = std::make_unique<simple_diagnostic_path> (&m_pp);
path->add_event (UNKNOWN_LOCATION, fndecl_foo, 0, "first %qs", "free");
path->add_event (UNKNOWN_LOCATION, fndecl_foo, 0, "double %qs", "free");
return path;
is skipped. */
{
test_diagnostic_context dc;
- dc.set_option_manager (::make_unique<all_warnings_disabled> (), 0);
+ dc.set_option_manager (std::make_unique<all_warnings_disabled> (), 0);
test_rich_location rich_loc (*event_pp);
ASSERT_FALSE (rich_loc.m_path.generated_p ());
#include "diagnostic-format-text.h"
#include "logical-location.h"
#include "edit-context.h"
-#include "make-unique.h"
#include "libgdiagnostics.h"
class owned_nullable_string
m_dc.m_client_aux_data = this;
m_dc.set_client_data_hooks
- (::make_unique<impl_diagnostic_client_data_hooks> (*this));
+ (std::make_unique<impl_diagnostic_client_data_hooks> (*this));
diagnostic_text_starter (&m_dc) = diagnostic_text_sink::text_starter;
- m_edit_context = ::make_unique <edit_context> (m_dc.get_file_cache ());
+ m_edit_context = std::make_unique <edit_context> (m_dc.get_file_cache ());
}
~diagnostic_manager ()
return (*iter).second.get ();
std::unique_ptr<diagnostic_logical_location> logical_loc
- = ::make_unique<diagnostic_logical_location> (kind,
- parent,
- short_name,
- fully_qualified_name,
- decorated_name);
+ = std::make_unique<diagnostic_logical_location> (kind,
+ parent,
+ short_name,
+ fully_qualified_name,
+ decorated_name);
const diagnostic_logical_location *result = logical_loc.get ();
m_logical_locs.insert
(logical_locs_map_t::value_type (std::move (key),
const char *gmsgid,
va_list *args)
{
- m_events.push_back (::make_unique<libgdiagnostics_path_event> (physical_loc,
- logical_loc,
- stack_depth,
- gmsgid,
- args));
+ m_events.push_back
+ (std::make_unique<libgdiagnostics_path_event> (physical_loc,
+ logical_loc,
+ stack_depth,
+ gmsgid,
+ args));
return m_events.size () - 1;
}
void add_rule (const char *title,
const char *url)
{
- std::unique_ptr<impl_rule> rule = ::make_unique<impl_rule> (title, url);
+ std::unique_ptr<impl_rule> rule = std::make_unique<impl_rule> (title, url);
m_metadata.add_rule (*rule.get ());
m_rules.push_back (std::move (rule));
}
const char *text)
{
std::unique_ptr<range_label> label
- = ::make_unique <impl_range_label> (text);
+ = std::make_unique <impl_range_label> (text);
m_rich_loc.add_range (as_location_t (loc),
SHOW_RANGE_WITHOUT_CARET,
label.get ());
diagnostic_execution_path *
add_execution_path ()
{
- m_path = ::make_unique<diagnostic_execution_path> ();
+ m_path = std::make_unique<diagnostic_execution_path> ();
m_rich_loc.set_path (m_path.get ());
return m_path.get ();
}
void
diagnostic_file::set_buffered_content (const char *buf, size_t sz)
{
- m_content = ::make_unique<content_buffer> (buf, sz);
+ m_content = std::make_unique<content_buffer> (buf, sz);
// Populate file_cache:
file_cache &fc = m_mgr.get_dc ().get_file_cache ();
m_source_printing (mgr.get_dc ().m_source_printing)
{
auto inner_sink
- = ::make_unique<diagnostic_text_output_format> (mgr.get_dc (),
- &m_source_printing);
+ = std::make_unique<diagnostic_text_output_format> (mgr.get_dc (),
+ &m_source_printing);
inner_sink->get_printer ()->set_output_stream (dst_stream);
m_inner_sink = inner_sink.get ();
set_colorize (colorize);
break;
}
- diag_mgr->add_sink (make_unique<sarif_sink> (*diag_mgr,
- dst_stream,
- main_input_file,
- sarif_gen_opts));
+ diag_mgr->add_sink (std::make_unique<sarif_sink> (*diag_mgr,
+ dst_stream,
+ main_input_file,
+ sarif_gen_opts));
}
/* Public entrypoint. */
#define INCLUDE_STRING
#include "system.h"
#include "coretypes.h"
-#include "make-unique.h"
#include "libgdiagnostics++.h"
#include "json-parsing.h"
#include "intl.h"
}
/* Read content, allocating a buffer for it. */
- auto result = ::make_unique<std::vector<char>> ();
+ auto result = std::make_unique<std::vector<char>> ();
char buf[4096];
size_t iter_sz_in;
}
iter_src = iter;
- return ::make_unique<embedded_link> (std::move (result));
+ return std::make_unique<embedded_link> (std::move (result));
}
/* Lookup the plain text string within a result.message (§3.27.11),
#include "opts-diagnostic.h"
#include "opt-suggestions.h"
#include "opts-jobserver.h"
-#include "make-unique.h"
#include "lto-ltrans-cache.h"
/* Environment variable, used for passing the names of offload targets from GCC
+++ /dev/null
-/* Minimal implementation of make_unique for C++11 compatibility.
- Copyright (C) 2022-2025 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 3, or (at your option) any later
-version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3. If not see
-<http://www.gnu.org/licenses/>. */
-
-#ifndef GCC_MAKE_UNIQUE
-#define GCC_MAKE_UNIQUE
-
-#include <type_traits>
-
-/* Minimal implementation of make_unique for C++11 compatibility
- (std::make_unique is C++14). */
-
-template<typename T, typename... Args>
-inline typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
-make_unique(Args&&... args)
-{
- return std::unique_ptr<T> (new T (std::forward<Args> (args)...));
-}
-
-#endif /* ! GCC_MAKE_UNIQUE */
#include "pretty-print-markup.h"
#include "opts.h"
#include "options.h"
-#include "make-unique.h"
/* A namespace for handling the DSL of the arguments of
-fdiagnostics-add-output= and -fdiagnostics-set-output=. */
}
else
result.m_scheme_name = unparsed_arg;
- return ::make_unique<scheme_name_and_params> (std::move (result));
+ return std::make_unique<scheme_name_and_params> (std::move (result));
}
/* class output_factory::scheme_handler. */
output_factory::output_factory ()
{
- m_scheme_handlers.push_back (::make_unique<text_scheme_handler> ());
- m_scheme_handlers.push_back (::make_unique<sarif_scheme_handler> ());
+ m_scheme_handlers.push_back (std::make_unique<text_scheme_handler> ());
+ m_scheme_handlers.push_back (std::make_unique<sarif_scheme_handler> ());
}
const output_factory::scheme_handler *
return nullptr;
}
- auto sink = ::make_unique<diagnostic_text_output_format> (ctxt.m_dc);
+ auto sink = std::make_unique<diagnostic_text_output_format> (ctxt.m_dc);
sink->set_show_nesting (show_nesting);
sink->set_show_locations_in_nesting (show_locations_in_nesting);
sink->set_show_nesting_levels (show_levels);
#include "diagnostic-color.h"
#include "diagnostic-event-id.h"
#include "diagnostic-highlight-colors.h"
-#include "make-unique.h"
#include "selftest.h"
#if HAVE_ICONV
std::unique_ptr<pretty_printer>
pretty_printer::clone () const
{
- return ::make_unique<pretty_printer> (*this);
+ return std::make_unique<pretty_printer> (*this);
}
/* Append a string delimited by START and END to the output area of
void add_to_phase_2 (pp_markup::context &ctxt) final override
{
- auto val_ptr = make_unique<value> (*this);
+ auto val_ptr = std::make_unique<value> (*this);
ctxt.m_formatted_token_list->push_back<pp_token_custom_data>
(std::move (val_ptr));
}
void add_to_phase_2 (pp_markup::context &ctxt) final override
{
- auto val_ptr = make_unique<value> (*this);
+ auto val_ptr = std::make_unique<value> (*this);
ctxt.m_formatted_token_list->push_back<pp_token_custom_data>
(std::move (val_ptr));
}
#include "analyzer/call-details.h"
#include "analyzer/call-info.h"
#include "analyzer/exploded-graph.h"
-#include "make-unique.h"
int plugin_is_GPL_compatible;
std::unique_ptr<stmt_finder>
clone () const final override
{
- return make_unique<refcnt_stmt_finder> (m_eg, m_var);
+ return std::make_unique<refcnt_stmt_finder> (m_eg, m_var);
}
const gimple *
const auto &eg = ctxt->get_eg ();
refcnt_stmt_finder finder (*eg, reg_tree);
- auto pd = make_unique<refcnt_mismatch> (curr_region, ob_refcnt_sval,
- actual_refcnt_sval, reg_tree);
+ auto pd = std::make_unique<refcnt_mismatch> (curr_region, ob_refcnt_sval,
+ actual_refcnt_sval,
+ reg_tree);
if (pd && eg)
ctxt->warn (std::move (pd), &finder);
}
/* Body of kf_PyList_Append::impl_call_post. */
if (cd.get_ctxt ())
{
- cd.get_ctxt ()->bifurcate (make_unique<realloc_failure> (cd));
- cd.get_ctxt ()->bifurcate (make_unique<realloc_success_no_move> (cd));
- cd.get_ctxt ()->bifurcate (make_unique<realloc_success_move> (cd));
+ cd.get_ctxt ()->bifurcate (std::make_unique<realloc_failure> (cd));
+ cd.get_ctxt ()->bifurcate (std::make_unique<realloc_success_no_move> (cd));
+ cd.get_ctxt ()->bifurcate (std::make_unique<realloc_success_move> (cd));
cd.get_ctxt ()->terminate_path ();
}
}
if (cd.get_ctxt ())
{
- cd.get_ctxt ()->bifurcate (make_unique<pyobj_init_fail> (cd));
- cd.get_ctxt ()->bifurcate (make_unique<success> (cd));
+ cd.get_ctxt ()->bifurcate (std::make_unique<pyobj_init_fail> (cd));
+ cd.get_ctxt ()->bifurcate (std::make_unique<success> (cd));
cd.get_ctxt ()->terminate_path ();
}
}
if (cd.get_ctxt ())
{
- cd.get_ctxt ()->bifurcate (make_unique<pyobj_init_fail> (cd));
- cd.get_ctxt ()->bifurcate (make_unique<success> (cd));
+ cd.get_ctxt ()->bifurcate (std::make_unique<pyobj_init_fail> (cd));
+ cd.get_ctxt ()->bifurcate (std::make_unique<success> (cd));
cd.get_ctxt ()->terminate_path ();
}
}
}
iface->register_known_function ("PyList_Append",
- make_unique<kf_PyList_Append> ());
- iface->register_known_function ("PyList_New", make_unique<kf_PyList_New> ());
+ std::make_unique<kf_PyList_Append> ());
+ iface->register_known_function ("PyList_New", std::make_unique<kf_PyList_New> ());
iface->register_known_function ("PyLong_FromLong",
- make_unique<kf_PyLong_FromLong> ());
+ std::make_unique<kf_PyLong_FromLong> ());
iface->register_known_function (
"__analyzer_cpython_dump_refcounts",
- make_unique<kf_analyzer_cpython_dump_refcounts> ());
+ std::make_unique<kf_analyzer_cpython_dump_refcounts> ());
}
} // namespace ana
#include "config.h"
#include "system.h"
#include "coretypes.h"
-#include "make-unique.h"
#include "diagnostic.h"
#include "tree.h"
#include "gimple.h"
if (type_based_on_pyobject_p (type))
{
sm_ctxt.warn (node, &call, NULL_TREE,
- make_unique<fncall_without_gil> (*this, call,
- callee_fndecl,
- i));
+ std::make_unique<fncall_without_gil> (*this, call,
+ callee_fndecl,
+ i));
sm_ctxt.set_global_state (m_stop);
}
}
if (global_state == m_released_gil)
{
sm_ctxt.warn (node, stmt, NULL_TREE,
- make_unique<double_save_thread> (*this, call));
+ std::make_unique<double_save_thread> (*this, call));
sm_ctxt.set_global_state (m_stop);
}
else
if (type_based_on_pyobject_p (type))
{
sm_ctxt.warn (node, stmt, NULL_TREE,
- make_unique<pyobject_usage_without_gil> (*this, op));
+ std::make_unique<pyobject_usage_without_gil> (*this, op));
sm_ctxt.set_global_state (m_stop);
}
}
if (0)
inform (input_location, "got here: gil_analyzer_init_cb");
iface->register_state_machine
- (make_unique<gil_state_machine> (iface->get_logger ()));
+ (std::make_unique<gil_state_machine> (iface->get_logger ()));
}
} // namespace ana
#include "analyzer/region-model.h"
#include "analyzer/call-details.h"
#include "analyzer/call-info.h"
-#include "make-unique.h"
int plugin_is_GPL_compatible;
if (ctxt)
{
/* Bifurcate state, creating a "failure" out-edge. */
- ctxt->bifurcate (make_unique<copy_failure> (cd));
+ ctxt->bifurcate (std::make_unique<copy_failure> (cd));
/* The "unbifurcated" state is the "success" case. */
copy_success success (cd,
inform (input_location, "got here: kernel_analyzer_init_cb");
iface->register_known_function
("copy_from_user",
- make_unique<known_function_copy_from_user> ());
- iface->register_known_function ("copy_to_user",
- make_unique<known_function_copy_to_user> ());
- iface->register_known_function ("__check_object_size",
- make_unique<known_function___check_object_size> ());
+ std::make_unique<known_function_copy_from_user> ());
+ iface->register_known_function
+ ("copy_to_user",
+ std::make_unique<known_function_copy_to_user> ());
+ iface->register_known_function
+ ("__check_object_size",
+ std::make_unique<known_function___check_object_size> ());
}
} // namespace ana
#include "analyzer/region-model.h"
#include "analyzer/call-details.h"
#include "analyzer/call-info.h"
-#include "make-unique.h"
int plugin_is_GPL_compatible;
if (cd.get_ctxt ())
{
/* Bifurcate state, creating a "failure" out-edge. */
- cd.get_ctxt ()->bifurcate (make_unique<copy_failure> (cd));
+ cd.get_ctxt ()->bifurcate (std::make_unique<copy_failure> (cd));
/* The "unbifurcated" state is the "success" case. */
copy_success success (cd,
LOG_SCOPE (iface->get_logger ());
if (0)
inform (input_location, "got here: known_fn_analyzer_init_cb");
- iface->register_known_function ("returns_42",
- make_unique<known_function_returns_42> ());
+ iface->register_known_function
+ ("returns_42",
+ std::make_unique<known_function_returns_42> ());
iface->register_known_function
("attempt_to_copy",
- make_unique<known_function_attempt_to_copy> ());
+ std::make_unique<known_function_attempt_to_copy> ());
}
} // namespace ana
#include "diagnostic.h"
#include "diagnostic-format-text.h"
#include "context.h"
-#include "make-unique.h"
int plugin_is_GPL_compatible;
diagnostic_text_starter (global_dc) = test_diagnostic_text_starter;
diagnostic_start_span (global_dc) = test_diagnostic_start_span_fn;
- global_dc->set_output_format (::make_unique<test_output_format> (*global_dc));
+ global_dc->set_output_format
+ (::std::make_unique<test_output_format> (*global_dc));
pass_info.pass = new pass_test_groups (g);
pass_info.reference_pass_name = "*warn_function_noreturn";
#include "diagnostic-buffer.h"
#include "ordered-hash-map.h"
#include "sbitmap.h"
-#include "make-unique.h"
#include "selftest.h"
#include "selftest-diagnostic.h"
#include "selftest-diagnostic-show-locus.h"
node_with_children::add_text (label_text str)
{
gcc_assert (str.get ());
- add_child (::make_unique <text> (std::move (str)));
+ add_child (std::make_unique <text> (std::move (str)));
}
static std::unique_ptr<xml::element>
make_div (label_text class_)
{
- auto div = ::make_unique<xml::element> ("div", false);
+ auto div = std::make_unique<xml::element> ("div", false);
div->set_attr ("class", std::move (class_));
return div;
}
static std::unique_ptr<xml::element>
make_span (label_text class_)
{
- auto span = ::make_unique<xml::element> ("span", true);
+ auto span = std::make_unique<xml::element> ("span", true);
span->set_attr ("class", std::move (class_));
return span;
}
{
gcc_assert (m_line_maps);
- m_document = ::make_unique<xml::document> ();
+ m_document = std::make_unique<xml::document> ();
{
- auto html_element = ::make_unique<xml::element> ("html", false);
+ auto html_element = std::make_unique<xml::element> ("html", false);
html_element->set_attr
("xmlns",
label_text::borrow ("http://www.w3.org/1999/xhtml"));
{
{
- auto head_element = ::make_unique<xml::element> ("head", false);
+ auto head_element = std::make_unique<xml::element> ("head", false);
{
- auto title_element = ::make_unique<xml::element> ("title", true);
+ auto title_element = std::make_unique<xml::element> ("title", true);
label_text title (label_text::borrow ("Title goes here")); // TODO
title_element->add_text (std::move (title));
head_element->add_child (std::move (title_element));
}
html_element->add_child (std::move (head_element));
- auto body_element = ::make_unique<xml::element> ("body", false);
+ auto body_element = std::make_unique<xml::element> ("body", false);
{
auto diagnostics_element
= make_div (label_text::borrow ("gcc-diagnostic-list"));
case pp_token::kind::begin_url:
{
pp_token_begin_url *sub = as_a <pp_token_begin_url *> (iter);
- auto anchor = ::make_unique<xml::element> ("a", true);
+ auto anchor = std::make_unique<xml::element> ("a", true);
anchor->set_attr ("href", std::move (sub->m_value));
push_element (std::move (anchor));
}
auto cwe_span = make_span (label_text::borrow ("gcc-cwe-metadata"));
cwe_span->add_text (label_text::borrow ("["));
{
- auto anchor = ::make_unique<xml::element> ("a", true);
+ auto anchor = std::make_unique<xml::element> ("a", true);
anchor->set_attr ("href", label_text::take (get_cwe_url (cwe)));
pretty_printer pp;
pp_printf (&pp, "CWE-%i", cwe);
{
if (option_url.get ())
{
- auto anchor = ::make_unique<xml::element> ("a", true);
+ auto anchor = std::make_unique<xml::element> ("a", true);
anchor->set_attr ("href", std::move (option_url));
anchor->add_text (std::move (option_text));
option_span->add_child (std::move (anchor));
}
{
- auto pre = ::make_unique<xml::element> ("pre", true);
+ auto pre = std::make_unique<xml::element> ("pre", true);
pre->set_attr ("class", label_text::borrow ("gcc-annotated-source"));
// TODO: ideally we'd like to capture elements within the following:
diagnostic_show_locus (&m_context, m_context.m_source_printing,
std::unique_ptr<diagnostic_per_format_buffer>
make_per_format_buffer () final override
{
- return ::make_unique<diagnostic_xhtml_format_buffer> (m_builder);
+ return std::make_unique<diagnostic_xhtml_format_buffer> (m_builder);
}
void set_buffer (diagnostic_per_format_buffer *base_buffer) final override
{
const line_maps *line_maps)
{
gcc_assert (line_maps);
- auto format = ::make_unique<xhtml_stream_output_format> (context,
- line_maps,
- stderr);
+ auto format = std::make_unique<xhtml_stream_output_format> (context,
+ line_maps,
+ stderr);
diagnostic_output_format_init_xhtml (context, std::move (format));
}
const char *base_file_name)
{
gcc_assert (line_maps);
- auto format = ::make_unique<xhtml_file_output_format> (context,
- line_maps,
- base_file_name);
+ auto format = std::make_unique<xhtml_file_output_format> (context,
+ line_maps,
+ base_file_name);
diagnostic_output_format_init_xhtml (context, std::move (format));
}
public:
test_xhtml_diagnostic_context ()
{
- auto format = ::make_unique<xhtml_buffered_output_format> (*this,
- line_table);
+ auto format = std::make_unique<xhtml_buffered_output_format> (*this,
+ line_table);
m_format = format.get (); // borrowed
diagnostic_output_format_init_xhtml (*this, std::move (format));
}
return 1;
global_dc->set_output_format
- (::make_unique<xhtml_stream_output_format> (*global_dc,
- line_table,
- stderr));
+ (std::make_unique<xhtml_stream_output_format> (*global_dc,
+ line_table,
+ stderr));
#if CHECKING_P
selftest::xhtml_format_selftests ();
#define INCLUDE_VECTOR
#include "system.h"
#include "coretypes.h"
-#include "make-unique.h"
#include "pretty-print.h"
#include "intl.h"
#include "selftest.h"
#define INCLUDE_VECTOR
#include "system.h"
#include "coretypes.h"
-#include "make-unique.h"
#include "pretty-print.h"
#include "intl.h"
#include "diagnostic.h"
#define INCLUDE_VECTOR
#include "system.h"
#include "coretypes.h"
-#include "make-unique.h"
#include "pretty-print.h"
#include "diagnostic.h"
#include "selftest.h"
#include "coretypes.h"
#include "pretty-print.h"
#include "selftest.h"
-#include "make-unique.h"
#include "text-art/selftests.h"
#include "text-art/tree-widget.h"
#include "text-art/dump-widget-info.h"
std::unique_ptr<tree_widget>
tree_widget::make (styled_string str, const theme &theme, style::id_t style_id)
{
- return ::make_unique <tree_widget>
- (::make_unique <text_widget> (std::move (str)),
+ return std::make_unique <tree_widget>
+ (std::make_unique <text_widget> (std::move (str)),
theme,
style_id);
}
#include "coretypes.h"
#include "pretty-print.h"
#include "selftest.h"
-#include "make-unique.h"
#include "text-art/selftests.h"
#include "text-art/widget.h"
test_wrapper_widget ()
{
style_manager sm;
- wrapper_widget w (::make_unique<test_widget> (canvas::size_t (3, 3), 'B'));
+ wrapper_widget w (std::make_unique<test_widget> (canvas::size_t (3, 3), 'B'));
canvas c (w.to_canvas (sm));
ASSERT_CANVAS_STREQ
(c, false,
vbox_widget w;
for (int i = 0; i < 5; i++)
w.add_child
- (::make_unique <text_widget>
+ (std::make_unique <text_widget>
(styled_string::from_fmt (sm, nullptr,
"this is line %i", i)));
canvas c (w.to_canvas (sm));
{
style_manager sm;
vbox_widget w;
- w.add_child (::make_unique<test_widget> (canvas::size_t (1, 3), 'A'));
- w.add_child (::make_unique<test_widget> (canvas::size_t (4, 1), 'B'));
- w.add_child (::make_unique<test_widget> (canvas::size_t (1, 2), 'C'));
+ w.add_child (std::make_unique<test_widget> (canvas::size_t (1, 3), 'A'));
+ w.add_child (std::make_unique<test_widget> (canvas::size_t (4, 1), 'B'));
+ w.add_child (std::make_unique<test_widget> (canvas::size_t (1, 2), 'C'));
canvas c (w.to_canvas (sm));
ASSERT_CANVAS_STREQ
(c, false,
#include "timevar.h"
#include "options.h"
#include "json.h"
-#include "make-unique.h"
/* Non-NULL if timevars should be used. In GCC, this happens with
the -ftime-report flag. */
std::unique_ptr<json::value>
timer::named_items::make_json () const
{
- auto arr = ::make_unique<json::array> ();
+ auto arr = std::make_unique<json::array> ();
for (const char *item_name : m_names)
{
hash_map_t &mut_map = const_cast <hash_map_t &> (m_hash_map);
std::unique_ptr<json::object>
make_json_for_timevar_time_def (const timevar_time_def &ttd)
{
- auto obj = ::make_unique<json::object> ();
+ auto obj = std::make_unique<json::object> ();
obj->set_float ("wall", nanosec_to_floating_sec (ttd.wall));
obj->set_integer ("ggc_mem", ttd.ggc_mem);
return obj;
std::unique_ptr<json::value>
timer::timevar_def::make_json () const
{
- auto timevar_obj = ::make_unique<json::object> ();
+ auto timevar_obj = std::make_unique<json::object> ();
timevar_obj->set_string ("name", name);
timevar_obj->set ("elapsed", make_json_for_timevar_time_def (elapsed));
}
if (any_children_with_time)
{
- auto children_arr = ::make_unique<json::array> ();
+ auto children_arr = std::make_unique<json::array> ();
for (auto i : *children)
{
/* Don't emit timing variables if we're going to get a row of
zeroes. */
if (all_zero (i.second))
continue;
- auto child_obj = ::make_unique<json::object> ();
+ auto child_obj = std::make_unique<json::object> ();
child_obj->set_string ("name", i.first->name);
child_obj->set ("elapsed",
make_json_for_timevar_time_def (i.second));
timer::make_json () const
{
#if defined (HAVE_WALL_TIME)
- auto report_obj = ::make_unique<json::object> ();
+ auto report_obj = std::make_unique<json::object> ();
json::array *json_arr = new json::array ();
report_obj->set ("timevars", json_arr);
get_time (&total_now);
timevar_diff (&total_elapsed, m_timevars[TV_TOTAL].start_time, total_now);
- auto total_obj = ::make_unique<json::object> ();
+ auto total_obj = std::make_unique<json::object> ();
total_obj->set_string ("name", "TOTAL");
total_obj->set ("elapsed", make_json_for_timevar_time_def (total_elapsed));
json_arr->append (std::move (total_obj));
#include "dbgcnt.h"
#include "gcc-urlifier.h"
#include "unique-argv.h"
-#include "make-unique.h"
#include "selftest.h"
global_dc->m_internal_error = internal_error_function;
const unsigned lang_mask = lang_hooks.option_lang_mask ();
global_dc->set_option_manager
- (::make_unique<compiler_diagnostic_option_manager> (*global_dc,
- lang_mask,
- &global_options),
+ (std::make_unique<compiler_diagnostic_option_manager> (*global_dc,
+ lang_mask,
+ &global_options),
lang_mask);
global_dc->push_owned_urlifier (make_gcc_urlifier (lang_mask));
#include "langhooks.h"
#include "plugin.h"
#include "timevar.h"
-#include "make-unique.h"
/* Concrete class for supplying a diagnostic_context with information
about a specific plugin within the client, when the client is the
std::unique_ptr<diagnostic_client_data_hooks>
make_compiler_data_hooks ()
{
- return ::make_unique<compiler_data_hooks> ();
+ return std::make_unique<compiler_data_hooks> ();
}