Skip to content

Make delete calls not look like function calls. #2298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions vpr/src/base/echo_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void setEchoFileEnabled(enum e_echo_files echo_option, bool value) {

void setEchoFileName(enum e_echo_files echo_option, const char* name) {
if (echoFileNames[(int)echo_option] != nullptr) {
delete[](echoFileNames[(int)echo_option]);
delete[] echoFileNames[(int)echo_option];
}
echoFileNames[(int)echo_option] = new char[strlen(name) + 1];
strcpy(echoFileNames[(int)echo_option], name);
Expand Down Expand Up @@ -140,7 +140,7 @@ void free_echo_file_info() {
if (echoFileEnabled != nullptr) {
for (i = 0; i < (int)E_ECHO_END_TOKEN; i++) {
if (echoFileNames[i] != nullptr) {
delete[](echoFileNames[i]);
delete[] echoFileNames[i];
}
}
delete[] echoFileNames;
Expand All @@ -155,7 +155,7 @@ void setOutputFileName(enum e_output_files ename, const char* name, const char*
alloc_and_load_output_file_names(default_name);
}
if (outputFileNames[(int)ename] != nullptr) {
delete[](outputFileNames[(int)ename]);
delete[] outputFileNames[(int)ename];
}
outputFileNames[(int)ename] = new char[strlen(name) + 1];
strcpy(outputFileNames[(int)ename], name);
Expand Down Expand Up @@ -189,7 +189,7 @@ void free_output_file_names() {
if (outputFileNames != nullptr) {
for (i = 0; i < (int)E_FILE_END_TOKEN; i++) {
if (outputFileNames[i] != nullptr) {
delete[](outputFileNames[i]);
delete[] outputFileNames[i];
outputFileNames[i] = nullptr;
}
}
Expand Down
4 changes: 2 additions & 2 deletions vpr/src/draw/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,9 @@ void free_draw_structs() {
t_draw_coords* draw_coords = get_draw_coords_vars();

if (draw_coords != nullptr) {
delete[](draw_coords->tile_x);
delete[] draw_coords->tile_x;
draw_coords->tile_x = nullptr;
delete[](draw_coords->tile_y);
delete[] draw_coords->tile_y;
draw_coords->tile_y = nullptr;
}

Expand Down
4 changes: 2 additions & 2 deletions vpr/src/pack/pb_type_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ static void alloc_and_load_mode_interconnect(t_pb_graph_node* pb_graph_parent_no
for (j = 0; j < num_input_pb_graph_node_sets; j++) {
delete[] input_pb_graph_node_pins[j];
}
delete[](input_pb_graph_node_pins);
delete[] input_pb_graph_node_pins;
for (j = 0; j < num_output_pb_graph_node_sets; j++) {
delete[] output_pb_graph_node_pins[j];
}
Expand Down Expand Up @@ -1469,7 +1469,7 @@ static bool realloc_and_load_pb_graph_pin_ptrs_at_var(const int line_num,

if (prev_num_pins > 0) {
std::vector<t_pb_graph_pin*> temp(*pb_graph_pins, *pb_graph_pins + prev_num_pins);
delete[](*pb_graph_pins);
delete[] * pb_graph_pins;
*pb_graph_pins = new t_pb_graph_pin*[*num_pins];
for (i = 0; i < prev_num_pins; i++)
(*pb_graph_pins)[i] = temp[i];
Expand Down
8 changes: 4 additions & 4 deletions vpr/src/place/place_macro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,17 +424,17 @@ void free_placement_macros_structs() {
unsigned int itype;
if (f_idirect_from_blk_pin != nullptr) {
for (itype = 1; itype < device_ctx.physical_tile_types.size(); itype++) {
delete[](f_idirect_from_blk_pin[itype]);
delete[] f_idirect_from_blk_pin[itype];
}
delete[](f_idirect_from_blk_pin);
delete[] f_idirect_from_blk_pin;
f_idirect_from_blk_pin = nullptr;
}

if (f_direct_type_from_blk_pin != nullptr) {
for (itype = 1; itype < device_ctx.physical_tile_types.size(); itype++) {
delete[](f_direct_type_from_blk_pin[itype]);
delete[] f_direct_type_from_blk_pin[itype];
}
delete[](f_direct_type_from_blk_pin);
delete[] f_direct_type_from_blk_pin;
f_direct_type_from_blk_pin = nullptr;
}
}
Expand Down
26 changes: 13 additions & 13 deletions vpr/src/power/power_components.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void power_components_init() {
*/
void power_components_uninit() {
auto& power_ctx = g_vpr_ctx.mutable_power();
delete[](power_ctx.by_component.components);
delete[] power_ctx.by_component.components;
}

/**
Expand Down Expand Up @@ -375,13 +375,13 @@ void power_usage_lut(t_power_usage* power_usage, int lut_size, float transistor_

/* Free allocated memory */
for (i = 0; i <= lut_size; i++) {
delete[](internal_prob[i]);
delete[](internal_dens[i]);
delete[](internal_v[i]);
delete[] internal_prob[i];
delete[] internal_dens[i];
delete[] internal_v[i];
}
delete[](internal_prob);
delete[](internal_dens);
delete[](internal_v);
delete[] internal_prob;
delete[] internal_dens;
delete[] internal_v;

/* Callibration */
callibration = power_ctx.commonly_used->component_callibration[POWER_CALLIB_COMPONENT_LUT];
Expand Down Expand Up @@ -507,8 +507,8 @@ void power_usage_local_interc_mux(t_power_usage* power_usage, t_pb* pb, t_interc
}
}

delete[](in_dens);
delete[](in_prob);
delete[] in_dens;
delete[] in_prob;
break;
default:
VTR_ASSERT(0);
Expand Down Expand Up @@ -561,7 +561,7 @@ void power_usage_mux_multilevel(t_power_usage* power_usage,
mux_arch->mux_graph_head, mux_arch, selector_values, in_prob,
in_dens, output_level_restored, period);

delete[](selector_values);
delete[] selector_values;

callibration = power_ctx.commonly_used->component_callibration[POWER_CALLIB_COMPONENT_MUX];
if (callibration->is_done_callibration()) {
Expand Down Expand Up @@ -625,11 +625,11 @@ static void power_usage_mux_rec(t_power_usage* power_usage, float* out_prob, flo
power_add_usage(power_usage, &sub_power_usage);

if (mux_node->level != 0) {
delete[](in_prob);
delete[](in_dens);
delete[] in_prob;
delete[] in_dens;
}

delete[](v_in);
delete[] v_in;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions vpr/src/power/power_sizing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static double power_count_transistors_mux(t_mux_arch* mux_arch) {

transistor_cnt += power_count_transistors_mux_node(mux_arch->mux_graph_head,
mux_arch->transistor_size);
delete[](max_inputs);
delete[] max_inputs;
return transistor_cnt;
}

Expand Down Expand Up @@ -773,8 +773,8 @@ static void power_size_pin_buffers_and_wires(t_pb_graph_pin* pin,
* this_pb_interc_sidelength;
}

delete[](fanout_per_mode);
delete[](wirelength_out_per_mode);
delete[] fanout_per_mode;
delete[] wirelength_out_per_mode;

/* Input wirelength - from parent PB */
if (!top_level_pb) {
Expand Down
6 changes: 3 additions & 3 deletions vpr/src/route/route_timing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1045,11 +1045,11 @@ void free_timing_driven_route_structs(float* pin_criticality, int* sink_order, t
/* Frees all the structures needed only by the timing-driven router. */

// coverity[offset_free : Intentional]
delete[](pin_criticality);
delete[] pin_criticality;
// coverity[offset_free : Intentional]
delete[](sink_order);
delete[] sink_order;
// coverity[offset_free : Intentional]
delete[](rt_node_of_sink);
delete[] rt_node_of_sink;

free_route_tree_timing_structs();
}
Expand Down
8 changes: 4 additions & 4 deletions vpr/src/route/rr_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ static void build_rr_graph(const t_graph_type graph_type,
track_to_pin_lookup_x.clear();
track_to_pin_lookup_y.clear();
if (clb_to_clb_directs != nullptr) {
delete[](clb_to_clb_directs);
delete[] clb_to_clb_directs;
}
}

Expand Down Expand Up @@ -3952,8 +3952,8 @@ static t_clb_to_clb_directs* alloc_and_load_clb_to_clb_directs(const t_direct_in
//Use the delayless switch by default
clb_to_clb_directs[i].switch_index = delayless_switch;
}
delete[](tile_name);
delete[](port_name);
delete[] tile_name;
delete[] port_name;
}

return clb_to_clb_directs;
Expand Down Expand Up @@ -4186,7 +4186,7 @@ static std::vector<bool> alloc_and_load_perturb_opins(const t_physical_tile_type
perturb_opins[0] = false;
}
}
delete[](prime_factors);
delete[] prime_factors;

return perturb_opins;
}
Expand Down
16 changes: 8 additions & 8 deletions vpr/src/route/rr_graph_area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,17 +284,17 @@ void count_bidir_routing_transistors(int num_switch, int wire_to_ipin_switch, fl
} /* End switch on from_rr_type */
} /* End for all nodes */

delete[](cblock_counted);
delete[](shared_buffer_trans);
delete[](unsharable_switch_trans);
delete[](sharable_switch_trans);
delete[] cblock_counted;
delete[] shared_buffer_trans;
delete[] unsharable_switch_trans;
delete[] sharable_switch_trans;

/* Now add in the input connection block transistors. */

input_cblock_trans = get_cblock_trans(num_inputs_to_cblock, wire_to_ipin_switch,
max_inputs_to_cblock, trans_sram_bit);

delete[](num_inputs_to_cblock);
delete[] num_inputs_to_cblock;

ntrans_sharing += input_cblock_trans;
ntrans_no_sharing += input_cblock_trans;
Expand Down Expand Up @@ -485,8 +485,8 @@ void count_unidir_routing_transistors(std::vector<t_segment_inf>& /*segment_inf*
input_cblock_trans = get_cblock_trans(num_inputs_to_cblock, wire_to_ipin_switch,
max_inputs_to_cblock, trans_sram_bit);

delete[](cblock_counted);
delete[](num_inputs_to_cblock);
delete[] cblock_counted;
delete[] num_inputs_to_cblock;

ntrans += input_cblock_trans;

Expand Down Expand Up @@ -528,7 +528,7 @@ static float get_cblock_trans(int* num_inputs_to_cblock, int wire_to_ipin_switch
trans_count += trans_per_cblock[num_inputs];
}

delete[](trans_per_cblock);
delete[] trans_per_cblock;
return (trans_count);
}

Expand Down
6 changes: 3 additions & 3 deletions vpr/src/route/rr_graph_timing_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void add_rr_graph_C_from_switches(float C_ipin_cblock) {
mutable_device_ctx.rr_graph_builder.set_node_rc_index(rr_id, NodeRCIndex(find_create_rr_rc_data(rr_graph.node_R(rr_id), rr_node_C[(size_t)rr_id], mutable_device_ctx.rr_rc_data)));
}

delete[](Couts_to_add);
delete[](cblock_counted);
delete[](buffer_Cin);
delete[] Couts_to_add;
delete[] cblock_counted;
delete[] buffer_Cin;
}
2 changes: 1 addition & 1 deletion vpr/src/util/vpr_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1598,7 +1598,7 @@ void free_pb_stats(t_pb* pb) {
pb->pb_stats->num_pins_of_net_in_pb.clear();

if (pb->pb_stats->feasible_blocks) {
delete[](pb->pb_stats->feasible_blocks);
delete[] pb->pb_stats->feasible_blocks;
}
if (!pb->parent_pb) {
pb->pb_stats->transitive_fanout_candidates.clear();
Expand Down