Skip to content

Commit 5d455e1

Browse files
author
sakirr
committed
clang-tidy: remove invalid override from Boost visitor callbacks
Boost graph visitors use non-virtual template callbacks, so `override` is not valid on these member functions. Remove `override` where the base class does not declare virtual methods. Fixes #3045
1 parent f932a42 commit 5d455e1

8 files changed

Lines changed: 16 additions & 16 deletions

include/dagShortestPath/dagShortestPath.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class Pgr_dag {
197197
m_goals(goals),
198198
m_n_goals(n_goals) {}
199199
template <class B_G>
200-
void examine_vertex(V u, B_G &) override {
200+
void examine_vertex(V u, B_G &) {
201201
auto s_it = m_goals.find(u);
202202
if (s_it == m_goals.end()) return;
203203

include/visitors/astar_visitors.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class astar_many_goals_visitor : public boost::default_astar_visitor {
4343
explicit astar_many_goals_visitor(const std::set<V> &goals)
4444
:m_goals(goals) {}
4545
template <class B_G>
46-
void examine_vertex(V u, B_G &g) override {
46+
void examine_vertex(V u, B_G &g) {
4747
auto s_it = m_goals.find(u);
4848
if (s_it == m_goals.end()) return;
4949
// found one more goal

include/visitors/dfs_visitor.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ class Dfs_visitor : public boost::default_dfs_visitor {
5959
m_depth.resize(m_graph.num_vertices(), 0);
6060
}
6161
template <typename B_G>
62-
void start_vertex(V v, const B_G&) override {
62+
void start_vertex(V v, const B_G&) {
6363
// exception for visitor termination
6464
if (v != m_roots) throw found_goals();
6565
m_depth[v] = 0;
6666
}
6767
template <typename B_G>
68-
void examine_edge(E e, const B_G&) override {
68+
void examine_edge(E e, const B_G&) {
6969
auto source = m_graph.source(e), target = m_graph.target(e);
7070
// If the target has not been visited before
7171
if (m_depth[target] == 0 && target != m_roots) {
@@ -79,7 +79,7 @@ class Dfs_visitor : public boost::default_dfs_visitor {
7979
}
8080
}
8181
template <typename B_G>
82-
void tree_edge(E e, const B_G&) override {
82+
void tree_edge(E e, const B_G&) {
8383
m_data.push_back(e);
8484
}
8585

include/visitors/dfs_visitor_with_root.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ class Dfs_visitor_with_root : public boost::default_dfs_visitor {
4747
m_data(data),
4848
m_roots(root) {}
4949
template <typename B_G>
50-
void tree_edge(E e, const B_G&) override {
50+
void tree_edge(E e, const B_G&) {
5151
m_data.push_back(e);
5252
}
5353
template <typename B_G>
54-
void start_vertex(V v, const B_G&) override {
54+
void start_vertex(V v, const B_G&) {
5555
if (v != m_roots) throw found_goals();
5656
}
5757

include/visitors/dijkstra_visitors.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class dijkstra_many_goal_visitor : public boost::default_dijkstra_visitor {
9090
m_found_goals(f_goals) {
9191
}
9292
template <class B_G>
93-
void examine_vertex(V u, B_G &) override {
93+
void examine_vertex(V u, B_G &) {
9494
auto s_it = m_goals.find(u);
9595

9696
/* examined vertex is not a goal */
@@ -125,7 +125,7 @@ class dijkstra_distance_visitor : public boost::default_dijkstra_visitor {
125125
pgassert(m_distance_goal > 0);
126126
}
127127
template <class B_G>
128-
void examine_vertex(V u, B_G &) override {
128+
void examine_vertex(V u, B_G &) {
129129
if (m_dist[u] > m_distance_goal) {
130130
throw found_goals();
131131
}
@@ -155,7 +155,7 @@ class dijkstra_distance_visitor_no_init : public boost::default_dijkstra_visitor
155155
}
156156

157157
template <class B_G>
158-
void examine_vertex(V u, B_G &) override {
158+
void examine_vertex(V u, B_G &) {
159159
if ( 0 == m_num_examined++) m_root = u;
160160
if (m_dist[u] > m_distance_goal) {
161161
throw found_goals();
@@ -166,22 +166,22 @@ class dijkstra_distance_visitor_no_init : public boost::default_dijkstra_visitor
166166
}
167167

168168
template <class B_G>
169-
void examine_edge(E e, B_G &g) override {
169+
void examine_edge(E e, B_G &g) {
170170
if (source(e, g) != m_root && m_predecessors[source(e, g)] == source(e, g)) {
171171
m_color[target(e, g)] = boost::black_color;
172172
}
173173
}
174174

175175

176176
template <class B_G>
177-
void edge_not_relaxed(E e, B_G &g) override {
177+
void edge_not_relaxed(E e, B_G &g) {
178178
if (source(e, g) != m_root && m_predecessors[source(e, g)] == source(e, g)) {
179179
m_color[target(e, g)] = boost::black_color;
180180
}
181181
}
182182

183183
template <class B_G>
184-
void discover_vertex(V u, B_G &) override {
184+
void discover_vertex(V u, B_G &) {
185185
if (u != m_root && m_predecessors[u] == u) {
186186
m_color[u] = boost::black_color;
187187
}

include/visitors/edges_order_bfs_visitor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Edges_order_bfs_visitor : public boost::default_bfs_visitor {
4444
std::vector<E> &data) :
4545
m_data(data) {}
4646
template <class B_G>
47-
void tree_edge(E e, const B_G&) override {
47+
void tree_edge(E e, const B_G&) {
4848
m_data.push_back(e);
4949
}
5050
private:

include/visitors/edges_order_dfs_visitor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Edges_order_dfs_visitor : public boost::default_dfs_visitor {
4545
std::vector<E> &data) :
4646
m_data(data) {}
4747
template <typename B_G>
48-
void tree_edge(E e, const B_G&) override {
48+
void tree_edge(E e, const B_G&) {
4949
m_data.push_back(e);
5050
}
5151
private:

include/visitors/prim_dijkstra_visitor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Prim_dijkstra_visitor : public boost::default_dijkstra_visitor {
4545
std::vector<V> &data) :
4646
m_data(data) {}
4747
template <class B_G>
48-
void finish_vertex(V v, B_G&) override {
48+
void finish_vertex(V v, B_G&) {
4949
m_data.push_back(v);
5050
}
5151
private:

0 commit comments

Comments
 (0)