#4376 closed defect (fixed)

covoar/ReportsBase Coverage::GenerateReports() uses raw pointer to std::list

Reported by: Alex White Owned by: Ryan Long <ryan.long@…>
Priority: normal Milestone: 6.1
Component: tool Version: 6
Severity: normal Keywords: coverage, covoar
Cc: Blocked By:
Blocking:

Description (last modified by Joel Sherrill)

The Coverage::GenerateReports() function uses a variable of type std::list<ReportsBase *> to store the ReportsBase-derived classes used to generate the reports. The function should use an std::vector<std::unique_ptr<ReportsBase>> instead.

An std::vector is the preferred container type in this case because the constant-time insertion and removal properties of std::list are not needed. The smart pointer type std::unique_ptr<ReportsBase> is preferred over ReportsBase * because it eliminates the need for manual pointer deletion at the end of the function.

Change History (2)

comment:1 Changed on 04/05/21 at 18:35:16 by Joel Sherrill

Component: admintool
Description: modified (diff)
Keywords: covoar added
Summary: covoar/ReportsBase Coverage::GenerateReports() uses raw pointer std::listcovoar/ReportsBase Coverage::GenerateReports() uses raw pointer to std::list

comment:2 Changed on 12/22/21 at 14:35:57 by Ryan Long <ryan.long@…>

Owner: set to Ryan Long <ryan.long@…>
Resolution: fixed
Status: newclosed

In 8167ad2/rtems-tools:

ReportsBase?: Change raw pointer to unique_ptr

Replaced raw pointer used with ReportsBase?-derived classes to make code
cleaner and make it to where pointers do not have to be manually
deleted.

Closes #4376

Note: See TracTickets for help on using tickets.