Skip to content

Commit c4eef94

Browse files
add noexcept to criteria
1 parent 4ce0c34 commit c4eef94

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

libs/libarchfpga/src/arch_util.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,14 @@ InstPort::name_index InstPort::parse_name_index(const std::string& str) {
140140

141141
int InstPort::num_instances() const {
142142
if (instance_high_index() == UNSPECIFIED || instance_low_index() == UNSPECIFIED) {
143-
throw ArchFpgaError("Unspecified instance indicies");
143+
throw ArchFpgaError("Unspecified instance indices");
144144
}
145145
return instance_high_index() - instance_low_index() + 1;
146146
}
147147

148148
int InstPort::num_pins() const {
149149
if (port_high_index() == UNSPECIFIED || port_low_index() == UNSPECIFIED) {
150-
throw ArchFpgaError("Unspecified port indicies");
150+
throw ArchFpgaError("Unspecified port indices");
151151
}
152152
return port_high_index() - port_low_index() + 1;
153153
}
@@ -1011,7 +1011,7 @@ void link_physical_logical_types(std::vector<t_physical_tile_type>& PhysicalTile
10111011
auto eq_sites_set = get_equivalent_sites_set(&physical_tile);
10121012
auto equivalent_sites = std::vector<t_logical_block_type_ptr>(eq_sites_set.begin(), eq_sites_set.end());
10131013

1014-
auto criteria = [&physical_tile](const t_logical_block_type* lhs, const t_logical_block_type* rhs) {
1014+
auto criteria = [&physical_tile](const t_logical_block_type* lhs, const t_logical_block_type* rhs) noexcept {
10151015
int num_pins = physical_tile.num_inst_pins;
10161016

10171017
int lhs_num_logical_pins = lhs->pb_type->num_pins;
@@ -1048,7 +1048,7 @@ void link_physical_logical_types(std::vector<t_physical_tile_type>& PhysicalTile
10481048
std::unordered_map<int, bool> ignored_pins_check_map;
10491049
std::unordered_map<int, bool> global_pins_check_map;
10501050

1051-
auto criteria = [&logical_block](const t_physical_tile_type* lhs, const t_physical_tile_type* rhs) {
1051+
auto criteria = [&logical_block](const t_physical_tile_type* lhs, const t_physical_tile_type* rhs) noexcept {
10521052
int num_logical_pins = logical_block.pb_type->num_pins;
10531053

10541054
int lhs_num_pins = lhs->num_inst_pins;
@@ -1063,7 +1063,7 @@ void link_physical_logical_types(std::vector<t_physical_tile_type>& PhysicalTile
10631063
std::ranges::stable_sort(equivalent_tiles, criteria);
10641064

10651065
for (int pin = 0; pin < logical_block.pb_type->num_pins; pin++) {
1066-
for (auto& tile : equivalent_tiles) {
1066+
for (t_physical_tile_type_ptr tile : equivalent_tiles) {
10671067
auto direct_maps = tile->tile_block_pin_directs_map.at(logical_block.index);
10681068

10691069
for (auto& sub_tile : tile->sub_tiles) {

libs/libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,12 +2632,12 @@ static void process_block_type_locs(t_grid_def& grid_def,
26322632
const pugiutil::loc_data& loc_data) {
26332633
//Process all the block location specifications
26342634
for (pugi::xml_node loc_spec_tag : layout_block_type_tag.children()) {
2635-
const char* loc_type = loc_spec_tag.name();
2635+
std::string_view loc_type = loc_spec_tag.name();
26362636

26372637
// There are multiple attributes that are shared by every other tag that interposer
26382638
// tags do not have. For this reason we check if loc_spec_tag is an interposer tag
26392639
// and switch code paths if it is.
2640-
if (loc_type == std::string("interposer_cut")) {
2640+
if (loc_type == "interposer_cut") {
26412641
if (grid_def.grid_type == e_grid_def_type::AUTO) {
26422642
archfpga_throw(loc_data.filename_c_str(), loc_data.line(loc_spec_tag), "Interposers are not currently supported for auto sized devices.");
26432643
}
@@ -2658,7 +2658,7 @@ static void process_block_type_locs(t_grid_def& grid_def,
26582658
int priority = get_attribute(loc_spec_tag, "priority", loc_data).as_int();
26592659
t_metadata_dict meta = process_meta_data(strings, loc_spec_tag, loc_data);
26602660

2661-
if (loc_type == std::string("perimeter")) {
2661+
if (loc_type == "perimeter") {
26622662
expect_only_attributes(loc_spec_tag, {"type", "priority"}, loc_data);
26632663

26642664
//The edges
@@ -2697,7 +2697,7 @@ static void process_block_type_locs(t_grid_def& grid_def,
26972697
grid_def.layers.at(die_number).loc_defs.emplace_back(std::move(top_edge));
26982698
grid_def.layers.at(die_number).loc_defs.emplace_back(std::move(bottom_edge));
26992699

2700-
} else if (loc_type == std::string("corners")) {
2700+
} else if (loc_type == "corners") {
27012701
expect_only_attributes(loc_spec_tag, {"type", "priority"}, loc_data);
27022702

27032703
//The corners
@@ -2736,7 +2736,7 @@ static void process_block_type_locs(t_grid_def& grid_def,
27362736
grid_def.layers.at(die_number).loc_defs.emplace_back(std::move(bottom_right));
27372737
grid_def.layers.at(die_number).loc_defs.emplace_back(std::move(top_right));
27382738

2739-
} else if (loc_type == std::string("fill")) {
2739+
} else if (loc_type == "fill") {
27402740
expect_only_attributes(loc_spec_tag, {"type", "priority"}, loc_data);
27412741

27422742
t_grid_loc_def fill(type_name, priority);
@@ -2750,7 +2750,7 @@ static void process_block_type_locs(t_grid_def& grid_def,
27502750

27512751
grid_def.layers.at(die_number).loc_defs.emplace_back(std::move(fill));
27522752

2753-
} else if (loc_type == std::string("single")) {
2753+
} else if (loc_type == "single") {
27542754
expect_only_attributes(loc_spec_tag, {"type", "priority", "x", "y"}, loc_data);
27552755

27562756
t_grid_loc_def single(type_name, priority);
@@ -2764,7 +2764,7 @@ static void process_block_type_locs(t_grid_def& grid_def,
27642764

27652765
grid_def.layers.at(die_number).loc_defs.emplace_back(std::move(single));
27662766

2767-
} else if (loc_type == std::string("col")) {
2767+
} else if (loc_type == "col") {
27682768
expect_only_attributes(loc_spec_tag, {"type", "priority", "startx", "repeatx", "starty", "incry"}, loc_data);
27692769

27702770
t_grid_loc_def col(type_name, priority);
@@ -2794,7 +2794,7 @@ static void process_block_type_locs(t_grid_def& grid_def,
27942794

27952795
grid_def.layers.at(die_number).loc_defs.emplace_back(std::move(col));
27962796

2797-
} else if (loc_type == std::string("row")) {
2797+
} else if (loc_type == "row") {
27982798
expect_only_attributes(loc_spec_tag, {"type", "priority", "starty", "repeaty", "startx", "incrx"}, loc_data);
27992799

28002800
t_grid_loc_def row(type_name, priority);
@@ -2823,7 +2823,7 @@ static void process_block_type_locs(t_grid_def& grid_def,
28232823
row.meta = row.owned_meta.get();
28242824

28252825
grid_def.layers.at(die_number).loc_defs.emplace_back(std::move(row));
2826-
} else if (loc_type == std::string("region")) {
2826+
} else if (loc_type == "region") {
28272827
expect_only_attributes(loc_spec_tag,
28282828
{"type", "priority",
28292829
"startx", "endx", "repeatx", "incrx",
@@ -4094,12 +4094,12 @@ static void process_bend(pugi::xml_node node, t_segment_inf& segment, const int
40944094
std::vector<int>& part_len = segment.part_len;
40954095
bool& is_bend = segment.is_bend;
40964096

4097-
std::string tmp = std::string(get_attribute(node, "type", loc_data).value());
4097+
std::string tmp = get_attribute(node, "type", loc_data).value();
40984098
if (tmp == "pattern") {
40994099
int i = 0;
41004100

4101-
/* Get the content string */
4102-
std::string content = std::string(node.child_value());
4101+
// Get the content string
4102+
std::string content = node.child_value();
41034103
for (char c : content) {
41044104
switch (c) {
41054105
case ' ':

vpr/src/base/load_flat_place.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ FlatPlacementInfo read_flat_placement(const std::string& read_flat_place_file_pa
187187
}
188188

189189
/* ingests and legalizes a flat placement file */
190-
bool load_flat_placement(t_vpr_setup& vpr_setup, const t_arch& arch) {
190+
bool load_flat_placement(const t_vpr_setup& vpr_setup, const t_arch& arch) {
191191
VTR_LOG("load_flat_placement(); when implemented, this function:");
192192
VTR_LOG("\n\tLoads flat placement file: %s, ", vpr_setup.FileNameOpts.FlatPlaceFile.c_str());
193193
VTR_LOG("\n\tArch id: %s, ", arch.architecture_id.c_str());

vpr/src/base/load_flat_place.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ FlatPlacementInfo read_flat_placement(const std::string& read_flat_place_file_pa
5959
/**
6060
* @brief A function that loads and legalizes a flat placement file
6161
*/
62-
bool load_flat_placement(t_vpr_setup& vpr_setup, const t_arch& arch);
62+
bool load_flat_placement(const t_vpr_setup& vpr_setup, const t_arch& arch);
6363

6464
/**
6565
* @brief Logs information on the quality of the clustering and placement

0 commit comments

Comments
 (0)