diff --git a/.github/scripts/install_dependencies.sh b/.github/scripts/install_dependencies.sh index 93215d9c419..383b237a89e 100755 --- a/.github/scripts/install_dependencies.sh +++ b/.github/scripts/install_dependencies.sh @@ -55,7 +55,7 @@ sudo apt install -y \ clang-16 \ clang-17 \ clang-18 \ - clang-format-14 \ + clang-format-18 \ libtbb-dev pip install -r requirements.txt diff --git a/cmake/modules/AutoClangFormat.cmake b/cmake/modules/AutoClangFormat.cmake index e4f6c3cb8a4..fb5e78d9f55 100644 --- a/cmake/modules/AutoClangFormat.cmake +++ b/cmake/modules/AutoClangFormat.cmake @@ -21,11 +21,11 @@ add_custom_target(format-cpp-files COMMAND find ${DIRS_TO_FORMAT_CPP} ${FIND_TO_FORMAT_CPP}) # -# Use clang-format-14 for code format +# Use clang-format for code format # add_custom_target(format-cpp COMMAND find ${DIRS_TO_FORMAT_CPP} ${FIND_TO_FORMAT_CPP} | - xargs -P ${CPU_COUNT} clang-format-14 -style=file -i) + xargs -P ${CPU_COUNT} clang-format-18 -style=file -i) # # Use simple python script for fixing C like boxed comments diff --git a/libs/libvtrutil/src/tl_optional.hpp b/libs/libvtrutil/src/tl_optional.hpp index 33f20cacc1d..3d5f037c559 100644 --- a/libs/libvtrutil/src/tl_optional.hpp +++ b/libs/libvtrutil/src/tl_optional.hpp @@ -516,7 +516,7 @@ struct optional_copy_assign_base : optional_move_base { // to make do with a non-trivial move assignment operator even if T is trivially // move assignable #ifndef TL_OPTIONAL_GCC49 -template::value&& std::is_trivially_move_constructible::value&& std::is_trivially_move_assignable::value> +template::value && std::is_trivially_move_constructible::value && std::is_trivially_move_assignable::value> struct optional_move_assign_base : optional_copy_assign_base { using optional_copy_assign_base::optional_copy_assign_base; }; @@ -539,7 +539,7 @@ struct optional_move_assign_base : optional_copy_assign_base { optional_move_assign_base& operator=(optional_move_assign_base&& rhs) noexcept( - std::is_nothrow_move_constructible::value&& std::is_nothrow_move_assignable::value) { + std::is_nothrow_move_constructible::value && std::is_nothrow_move_assignable::value) { this->assign(std::move(rhs)); return *this; } @@ -1243,7 +1243,7 @@ class optional : private detail::optional_move_assign_base, /// If one has a value, it is moved to the other and the movee is left /// valueless. void - swap(optional& rhs) noexcept(std::is_nothrow_move_constructible::value&& detail::is_nothrow_swappable::value) { + swap(optional& rhs) noexcept(std::is_nothrow_move_constructible::value && detail::is_nothrow_swappable::value) { using std::swap; if (has_value()) { if (rhs.has_value()) { diff --git a/libs/libvtrutil/src/vtr_memory.cpp b/libs/libvtrutil/src/vtr_memory.cpp index 65af6e8e566..4bea9f1c652 100644 --- a/libs/libvtrutil/src/vtr_memory.cpp +++ b/libs/libvtrutil/src/vtr_memory.cpp @@ -164,7 +164,7 @@ void free_chunk_memory(t_chunk* chunk_info) { while (curr_ptr != nullptr) { /* Must cast pointers to type char*, since the're of type void*, which delete can't * be called on.*/ - delete[]((char*)curr_ptr->data_vptr); /* Free memory "chunk". */ + delete[] ((char*)curr_ptr->data_vptr); /* Free memory "chunk". */ prev_ptr = curr_ptr; curr_ptr = curr_ptr->next; delete (t_linked_vptr*)prev_ptr; /* Free memory used to track "chunk". */ diff --git a/libs/libvtrutil/src/vtr_prefix_sum.h b/libs/libvtrutil/src/vtr_prefix_sum.h index d2a9067e1ae..31635904f1b 100644 --- a/libs/libvtrutil/src/vtr_prefix_sum.h +++ b/libs/libvtrutil/src/vtr_prefix_sum.h @@ -95,11 +95,11 @@ class PrefixSum1D { */ PrefixSum1D(std::vector vals, T zero = T()) : PrefixSum1D( - vals.size(), - [&](size_t x) noexcept { - return vals[x]; - }, - zero) {} + vals.size(), + [&](size_t x) noexcept { + return vals[x]; + }, + zero) {} /** * @brief Get the sum of all values in the original array of values between @@ -227,12 +227,12 @@ class PrefixSum2D { */ PrefixSum2D(const vtr::NdMatrix& vals, T zero = T()) : PrefixSum2D( - vals.dim_size(0), - vals.dim_size(1), - [&](size_t x, size_t y) { - return vals[x][y]; - }, - zero) {} + vals.dim_size(0), + vals.dim_size(1), + [&](size_t x, size_t y) { + return vals[x][y]; + }, + zero) {} /** * @brief Get the sum of all values in the original grid of values between diff --git a/vpr/src/draw/draw_rr_edges.cpp b/vpr/src/draw/draw_rr_edges.cpp index a637a9fd017..793487d04ab 100644 --- a/vpr/src/draw/draw_rr_edges.cpp +++ b/vpr/src/draw/draw_rr_edges.cpp @@ -181,7 +181,7 @@ void draw_chanx_to_chanx_edge(RRNodeId from_node, RRNodeId to_node, short switch + draw_coords->get_tile_width(); x2 = to_chan.left(); - } /* The following then is executed when from_xlow == to_xlow */ + } /* The following then is executed when from_xlow == to_xlow */ else if (to_xhigh > from_xhigh) { /* Draw from right edge of one to other */ x1 = from_chan.right(); x2 = draw_coords->tile_x[from_xhigh + 1]; diff --git a/vpr/src/pack/pb_type_graph.cpp b/vpr/src/pack/pb_type_graph.cpp index 2727d05e2b8..02784e4321a 100644 --- a/vpr/src/pack/pb_type_graph.cpp +++ b/vpr/src/pack/pb_type_graph.cpp @@ -1497,7 +1497,7 @@ static bool realloc_and_load_pb_graph_pin_ptrs_at_var(const int line_num, if (prev_num_pins > 0) { std::vector 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]; diff --git a/vpr/src/place/place_macro.cpp b/vpr/src/place/place_macro.cpp index ff564fd656c..4a8ccb62666 100644 --- a/vpr/src/place/place_macro.cpp +++ b/vpr/src/place/place_macro.cpp @@ -294,10 +294,10 @@ int PlaceMacros::find_all_the_macro_(const ClusteredNetlist& clb_nlist, num_macro++; } // Do nothing if the from_pins does not have same possible direct connection. - } // Finish going through all the pins for from_pins. - } // Do nothing if the to_pins does not have same possible direct connection. - } // Finish going through all the pins for to_pins. - } // Finish going through all blocks. + } // Finish going through all the pins for from_pins. + } // Do nothing if the to_pins does not have same possible direct connection. + } // Finish going through all the pins for to_pins. + } // Finish going through all blocks. // Now, all the data is readily stored in the temporary data structures. return num_macro; @@ -523,10 +523,10 @@ static void mark_direct_of_ports(int idirect, port_pin_to_block_pin); } } // Do nothing if port_name does not match - } // Finish going through all the ports - } // Finish going through all the subtiles - } // Do nothing if pb_type_name does not match - } // Finish going through all the blocks + } // Finish going through all the ports + } // Finish going through all the subtiles + } // Do nothing if pb_type_name does not match + } // Finish going through all the blocks } static void mark_direct_of_pins(int start_pin_index, diff --git a/vpr/src/place/verify_placement.cpp b/vpr/src/place/verify_placement.cpp index 92534f99c91..b40b55e1d6c 100644 --- a/vpr/src/place/verify_placement.cpp +++ b/vpr/src/place/verify_placement.cpp @@ -204,7 +204,7 @@ static unsigned check_macro_placement_consistency(const BlkLocRegistry& blk_loc_ num_errors++; } } // Finish going through all the members - } // Finish going through all the macros + } // Finish going through all the macros return num_errors; } diff --git a/vpr/src/route/rr_graph_area.cpp b/vpr/src/route/rr_graph_area.cpp index 3ac736eebd8..110f056c906 100644 --- a/vpr/src/route/rr_graph_area.cpp +++ b/vpr/src/route/rr_graph_area.cpp @@ -282,7 +282,7 @@ void count_bidir_routing_transistors(int num_switch, int wire_to_ipin_switch, fl break; } /* End switch on from_rr_type */ - } /* End for all nodes */ + } /* End for all nodes */ delete[] cblock_counted; delete[] shared_buffer_trans; @@ -478,7 +478,7 @@ void count_unidir_routing_transistors(std::vector& /*segment_inf* break; } /* End switch on from_rr_type */ - } /* End for all nodes */ + } /* End for all nodes */ /* Now add in the input connection block transistors. */