Modernization; no functional change intended.
gcc/analyzer/ChangeLog:
* access-diagram.cc
(access_diagram_impl::add_aligned_child_table): Use
std::make_unique rather than "new".
(access_diagram_impl::add_valid_vs_invalid_ruler): Likewise.
* checker-path.h (checker_path::replace_event): Use
std::unique_ptr.
* diagnostic-manager.cc
(diagnostic_manager::consolidate_conditions): Use std::make_unique
rather than "new".
* feasible-graph.cc (feasible_graph::make_epath): Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
void add_aligned_child_table (table t)
{
- x_aligned_table_widget *w
- = new x_aligned_table_widget (std::move (t), m_theme, *m_col_widths);
- m_aligned_table_widgets.push_back (w);
- add_child (std::unique_ptr<widget> (w));
+ auto w = std::make_unique<x_aligned_table_widget> (std::move (t),
+ m_theme, *m_col_widths);
+ m_aligned_table_widgets.push_back (w.get ());
+ add_child (std::move (w));
}
/* Create a table showing headings for use by -fanalyzer-debug-text-art, for
{
LOG_SCOPE (m_logger);
- x_aligned_x_ruler_widget *w
- = new x_aligned_x_ruler_widget (*this, m_theme);
+ auto w = std::make_unique<x_aligned_x_ruler_widget> (*this, m_theme);
access_range invalid_before_bits;
if (m_op.maybe_get_invalid_before_bits (&invalid_before_bits))
valid_bits.log ("valid_bits", *m_logger);
got_valid_bits = true;
- maybe_add_gap (w, invalid_before_bits, valid_bits);
+ maybe_add_gap (w.get (), invalid_before_bits, valid_bits);
std::unique_ptr<styled_string> label;
if (m_op.m_dir == access_direction::read)
if (m_op.maybe_get_invalid_after_bits (&invalid_after_bits))
{
if (got_valid_bits)
- maybe_add_gap (w, valid_bits, invalid_after_bits);
+ maybe_add_gap (w.get (), valid_bits, invalid_after_bits);
if (m_logger)
invalid_before_bits.log ("invalid_after_bits", *m_logger);
m_logger->log ("no invalid_after_bits");
}
- add_child (std::unique_ptr<widget> (w));
+ add_child (std::move (w));
}
/* Subroutine of calc_req_size.
m_events.block_remove (start_idx, len);
}
- void replace_event (unsigned idx, checker_event *new_event)
+ void replace_event (unsigned idx, std::unique_ptr<checker_event> new_event)
{
delete m_events[idx];
- m_events[idx] = new_event;
+ m_events[idx] = new_event.release ();
}
void add_region_creation_events (pending_diagnostic *pd,
= path->get_checker_event (next_idx - 1);
log ("consolidating CFG edge events %i-%i into %i-%i",
start_idx, next_idx - 1, start_idx, start_idx +1);
- start_consolidated_cfg_edges_event *new_start_ev
- = new start_consolidated_cfg_edges_event
- (event_loc_info (old_start_ev->get_location (),
- old_start_ev->get_fndecl (),
- old_start_ev->get_stack_depth ()),
+ auto new_start_ev
+ = std::make_unique<start_consolidated_cfg_edges_event>
+ (event_loc_info (old_start_ev->get_location (),
+ old_start_ev->get_fndecl (),
+ old_start_ev->get_stack_depth ()),
edge_sense);
- checker_event *new_end_ev
- = new end_consolidated_cfg_edges_event
- (event_loc_info (old_end_ev->get_location (),
- old_end_ev->get_fndecl (),
- old_end_ev->get_stack_depth ()));
- path->replace_event (start_idx, new_start_ev);
- path->replace_event (start_idx + 1, new_end_ev);
+ auto new_end_ev
+ = std::make_unique<end_consolidated_cfg_edges_event>
+ (event_loc_info (old_end_ev->get_location (),
+ old_end_ev->get_fndecl (),
+ old_end_ev->get_stack_depth ()));
+ path->replace_event (start_idx, std::move (new_start_ev));
+ path->replace_event (start_idx + 1, std::move (new_end_ev));
path->delete_events (start_idx + 2, next_idx - (start_idx + 2));
}
}
std::unique_ptr<exploded_path>
feasible_graph::make_epath (feasible_node *fnode) const
{
- std::unique_ptr<exploded_path> epath (new exploded_path ());
+ auto epath = std::make_unique<exploded_path> ();
/* FG is actually a tree. Built the path backwards, by walking
backwards from FNODE until we reach the origin. */