Skip to content

Commit f932a42

Browse files
author
sakirr
committed
clang-tidy: fix explicit virtual functions in remaining headers (Fix #3045)
1 parent 28c581a commit f932a42

14 files changed

Lines changed: 28 additions & 29 deletions

.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Checks: >
1111
-cppcoreguidelines-avoid-const-or-ref-data-members,
1212
-cppcoreguidelines-avoid-do-while,
1313
-cppcoreguidelines-avoid-magic-numbers,
14-
-cppcoreguidelines-explicit-virtual-functions,
1514
-cppcoreguidelines-macro-usage,
1615
-cppcoreguidelines-narrowing-conversions,
1716
-cppcoreguidelines-no-malloc,

include/bdAstar/bdAstar.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Pgr_bdAstar : public Pgr_bidirectional<G> {
7878
m_log << "pgr_bdAstar constructor\n";
7979
}
8080

81-
virtual ~Pgr_bdAstar() = default;
81+
~Pgr_bdAstar() override = default;
8282

8383
Path pgr_bdAstar(V start_vertex, V end_vertex,
8484
int heuristic,
@@ -98,7 +98,7 @@ class Pgr_bdAstar : public Pgr_bidirectional<G> {
9898
using Pgr_bidirectional<G>::clean_log;
9999

100100
private:
101-
void explore_forward(const Cost_Vertex_pair &node) {
101+
void explore_forward(const Cost_Vertex_pair &node) override {
102102
typename G::EO_i out, out_end;
103103

104104
auto current_node = node.second;
@@ -124,7 +124,7 @@ class Pgr_bdAstar : public Pgr_bidirectional<G> {
124124
forward_finished[current_node] = true;
125125
}
126126

127-
void explore_backward(const Cost_Vertex_pair &node) {
127+
void explore_backward(const Cost_Vertex_pair &node) override {
128128
typename G::EI_i in, in_end;
129129

130130
auto current_cost = node.first;

include/bdDijkstra/bdDijkstra.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class Pgr_bdDijkstra : public Pgr_bidirectional<G> {
8080
m_log << "pgr_bdDijkstra constructor\n";
8181
}
8282

83-
virtual ~Pgr_bdDijkstra() = default;
83+
~Pgr_bdDijkstra() override = default;
8484

8585
Path pgr_bdDijkstra(V start_vertex, V end_vertex, bool only_cost) {
8686
m_log << "pgr_bdDijkstra\n";
@@ -96,7 +96,7 @@ class Pgr_bdDijkstra : public Pgr_bidirectional<G> {
9696

9797

9898
private:
99-
void explore_forward(const Cost_Vertex_pair &node) {
99+
void explore_forward(const Cost_Vertex_pair &node) override {
100100
typename G::EO_i out, out_end;
101101

102102
auto current_cost = node.first;
@@ -119,7 +119,7 @@ class Pgr_bdDijkstra : public Pgr_bidirectional<G> {
119119
forward_finished[current_node] = true;
120120
}
121121

122-
void explore_backward(const Cost_Vertex_pair &node) {
122+
void explore_backward(const Cost_Vertex_pair &node) override {
123123
typename G::EI_i in, in_end;
124124

125125
auto current_cost = node.first;

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 &) {
200+
void examine_vertex(V u, B_G &) override {
201201
auto s_it = m_goals.find(u);
202202
if (s_it == m_goals.end()) return;
203203

include/spanningTree/kruskal.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace functions {
4242
template <class G>
4343
class Pgr_kruskal : public Pgr_mst<G> {
4444
public:
45-
virtual ~Pgr_kruskal() = default;
45+
~Pgr_kruskal() override = default;
4646
std::vector<MST_rt> kruskal(G &graph);
4747

4848
std::vector<MST_rt> kruskalBFS(
@@ -66,7 +66,7 @@ class Pgr_kruskal : public Pgr_mst<G> {
6666
typedef typename G::E E;
6767

6868
/* Does all the work */
69-
void generate_mst(const G &graph);
69+
void generate_mst(const G &graph) override;
7070
};
7171

7272

include/spanningTree/prim.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Pgr_prim : public Pgr_mst<G> {
5151
typedef typename G::B_G B_G;
5252

5353
public:
54-
virtual ~Pgr_prim() = default;
54+
~Pgr_prim() override = default;
5555
std::vector<MST_rt> prim(G &graph);
5656

5757
std::vector<MST_rt> primBFS(
@@ -82,7 +82,7 @@ class Pgr_prim : public Pgr_mst<G> {
8282
const G &graph,
8383
int64_t root_vertex);
8484

85-
void generate_mst(const G &graph);
85+
void generate_mst(const G &graph) override;
8686

8787
private:
8888
// Member

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) {
46+
void examine_vertex(V u, B_G &g) override {
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&) {
62+
void start_vertex(V v, const B_G&) override {
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&) {
68+
void examine_edge(E e, const B_G&) override {
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&) {
82+
void tree_edge(E e, const B_G&) override {
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&) {
50+
void tree_edge(E e, const B_G&) override {
5151
m_data.push_back(e);
5252
}
5353
template <typename B_G>
54-
void start_vertex(V v, const B_G&) {
54+
void start_vertex(V v, const B_G&) override {
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 &) {
93+
void examine_vertex(V u, B_G &) override {
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 &) {
128+
void examine_vertex(V u, B_G &) override {
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 &) {
158+
void examine_vertex(V u, B_G &) override {
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) {
169+
void examine_edge(E e, B_G &g) override {
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) {
177+
void edge_not_relaxed(E e, B_G &g) override {
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 &) {
184+
void discover_vertex(V u, B_G &) override {
185185
if (u != m_root && m_predecessors[u] == u) {
186186
m_color[u] = boost::black_color;
187187
}

0 commit comments

Comments
 (0)