Skip to content

Commit

Permalink
Update CI to use clang-tidy 14 (Project-OSRM#6353)
Browse files Browse the repository at this point in the history
  • Loading branch information
SiarheiFedartsou authored and mattwigway committed Jul 20, 2023
1 parent c315231 commit 57f7c15
Show file tree
Hide file tree
Showing 22 changed files with 24 additions and 35 deletions.
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Checks: >
-bugprone-unhandled-self-assignment,
-bugprone-forward-declaration-namespace,
-bugprone-sizeof-expression,
-bugprone-throw-keyword-missing,
-clang-analyzer-*,
-clang-diagnostic-deprecated-declarations,
-clang-diagnostic-constant-conversion,
Expand Down Expand Up @@ -64,6 +65,7 @@ Checks: >
-readability-else-after-return,
-readability-inconsistent-declaration-parameter-name,
-readability-isolate-declaration,
-readability-identifier-length,
-readability-redundant-declaration,
-readability-uppercase-literal-suffix,
-readability-named-parameter,
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/osrm-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ jobs:
- name: clang-11.0-debug-clang-tidy
continue-on-error: false
node: 12
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
BUILD_TOOLS: ON
BUILD_TYPE: Debug
CCOMPILER: clang-11
CXXCOMPILER: clang++-11
CCOMPILER: clang-14
CXXCOMPILER: clang++-14
CUCUMBER_TIMEOUT: 60000
ENABLE_CLANG_TIDY: ON

Expand Down
2 changes: 2 additions & 0 deletions include/engine/api/table_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ namespace api
class TableAPI final : public BaseAPI
{
public:
virtual ~TableAPI() = default;

struct TableCellRef
{
TableCellRef(const std::size_t &row, const std::size_t &column) : row{row}, column{column}
Expand Down
4 changes: 4 additions & 0 deletions include/engine/datafacade/algorithm_datafacade.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ template <> class AlgorithmDataFacade<CH>
using EdgeData = contractor::QueryEdge::EdgeData;
using EdgeRange = util::filtered_range<EdgeID, util::vector_view<bool>>;

virtual ~AlgorithmDataFacade() = default;

// search graph access
virtual unsigned GetNumberOfNodes() const = 0;

Expand Down Expand Up @@ -66,6 +68,8 @@ template <> class AlgorithmDataFacade<MLD>
using EdgeData = customizer::EdgeBasedGraphEdgeData;
using EdgeRange = util::range<EdgeID>;

virtual ~AlgorithmDataFacade() = default;

// search graph access
virtual unsigned GetNumberOfNodes() const = 0;

Expand Down
2 changes: 2 additions & 0 deletions include/engine/routing_algorithms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ namespace engine
class RoutingAlgorithmsInterface
{
public:
virtual ~RoutingAlgorithmsInterface() = default;

virtual InternalManyRoutesResult
AlternativePathSearch(const PhantomEndpointCandidates &endpoint_candidates,
unsigned number_of_alternatives) const = 0;
Expand Down
2 changes: 1 addition & 1 deletion include/extractor/raster_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class RasterGrid
for (unsigned int y = 0; y < ydim; y++)
{
// read one line from file.
file_reader.ReadLine(&buffer[0], xdim * 11);
file_reader.ReadLine(buffer.data(), xdim * 11);
boost::algorithm::trim(buffer);

std::vector<std::string> result;
Expand Down
10 changes: 5 additions & 5 deletions include/partitioner/partition_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ template <typename NodeEntryT, typename EdgeEntryT> class RemappableGraph

NodeID GetID(const NodeT &node) const
{
BOOST_ASSERT(&node >= &nodes[0] && &node <= &nodes.back());
return (&node - &nodes[0]);
BOOST_ASSERT(&node >= nodes.data() && &node <= &nodes.back());
return (&node - nodes.data());
}
EdgeID GetID(const EdgeT &edge) const
{
BOOST_ASSERT(&edge >= &edges[0] && &edge <= &edges.back());
return (&edge - &edges[0]);
BOOST_ASSERT(&edge >= edges.data() && &edge <= &edges.back());
return (&edge - edges.data());
}

NodeIterator Begin() { return nodes.begin(); }
Expand All @@ -142,7 +142,7 @@ template <typename NodeEntryT, typename EdgeEntryT> class RemappableGraph
// removes the edges from the graph that return true for the filter, returns new end
template <typename FilterT> auto RemoveEdges(NodeT &node, FilterT filter)
{
BOOST_ASSERT(&node >= &nodes[0] && &node <= &nodes.back());
BOOST_ASSERT(&node >= nodes.data() && &node <= &nodes.back());
// required since we are not on std++17 yet, otherwise we are missing an argument_type
const auto negate_filter = [&](const EdgeT &edge) { return !filter(edge); };
const auto center = std::stable_partition(BeginEdges(node), EndEdges(node), negate_filter);
Expand Down
3 changes: 0 additions & 3 deletions include/storage/view_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
#include "util/vector_view.hpp"

#include "util/filtered_graph.hpp"
#include "util/packed_vector.hpp"
#include "util/vector_view.hpp"

namespace osrm
{
namespace storage
Expand Down
2 changes: 1 addition & 1 deletion include/util/dist_table_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ template <typename T> class DistTableWrapper
DistTableWrapper(std::vector<T> table, std::size_t number_of_nodes)
: table_(std::move(table)), number_of_nodes_(number_of_nodes)
{
BOOST_ASSERT_MSG(table.size() == 0, "table is empty");
BOOST_ASSERT_MSG(!table_.empty(), "table is empty");
BOOST_ASSERT_MSG(number_of_nodes_ * number_of_nodes_ <= table_.size(),
"number_of_nodes_ is invalid");
}
Expand Down
4 changes: 2 additions & 2 deletions include/util/filtered_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ class FilteredGraphImpl<util::StaticGraph<EdgeDataT, Ownership>, Ownership>

FilteredGraphImpl() = default;

FilteredGraphImpl(Graph graph, Vector<bool> edge_filter_)
: graph(std::move(graph)), edge_filter(std::move(edge_filter_))
FilteredGraphImpl(Graph graph_, Vector<bool> edge_filter_)
: graph(std::move(graph_)), edge_filter(std::move(edge_filter_))
{
BOOST_ASSERT(edge_filter.empty() || edge_filter.size() == graph.GetNumberOfEdges());
}
Expand Down
2 changes: 1 addition & 1 deletion src/engine/datafacade/mmap_memory_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ MMapMemoryAllocator::MMapMemoryAllocator(const storage::StorageConfig &config)
// prior to C++17 (which we're not using), those return a `const char *`,
// which isn't compatible with the `char *` that AllocatedRegion expects
// for it's memory_ptr
allocated_regions.push_back({&(rtree_filename[0]), std::move(fake_layout)});
allocated_regions.push_back({rtree_filename.data(), std::move(fake_layout)});
}

auto files = storage.GetStaticFiles();
Expand Down
2 changes: 0 additions & 2 deletions src/engine/guidance/post_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include <boost/numeric/conversion/cast.hpp>
#include <boost/range/iterator_range.hpp>

#include "engine/guidance/collapsing_utility.hpp"

#include <algorithm>
#include <cmath>
#include <cstddef>
Expand Down
2 changes: 0 additions & 2 deletions src/extractor/intersection/coordinate_extractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include "util/bearing.hpp"
#include "util/coordinate_calculation.hpp"

using osrm::util::angularDeviation;

namespace osrm
{
namespace extractor
Expand Down
2 changes: 0 additions & 2 deletions src/guidance/intersection_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
#include "util/log.hpp"

#include "util/bearing.hpp"
#include "util/coordinate_calculation.hpp"

#include <algorithm>
#include <cstddef>

using EdgeData = osrm::util::NodeBasedDynamicGraph::EdgeData;
using osrm::guidance::getTurnDirection;
using osrm::util::angularDeviation;

namespace osrm
Expand Down
1 change: 0 additions & 1 deletion src/guidance/motorway_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include <boost/assert.hpp>

using osrm::guidance::getTurnDirection;
using osrm::util::angularDeviation;

namespace osrm
Expand Down
2 changes: 0 additions & 2 deletions src/guidance/roundabout_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

#include <boost/assert.hpp>

using osrm::guidance::getTurnDirection;

namespace osrm
{
namespace guidance
Expand Down
2 changes: 0 additions & 2 deletions src/guidance/segregated_intersection_classification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include "util/coordinate_calculation.hpp"
#include <set>

using osrm::guidance::getTurnDirection;

namespace osrm
{
namespace guidance
Expand Down
1 change: 0 additions & 1 deletion src/guidance/sliproad_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <boost/assert.hpp>

using osrm::guidance::getTurnDirection;
using osrm::util::angularDeviation;

namespace osrm
Expand Down
2 changes: 0 additions & 2 deletions src/guidance/turn_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include <unordered_set>
#include <utility>

using osrm::guidance::getTurnDirection;

namespace osrm
{
namespace guidance
Expand Down
1 change: 0 additions & 1 deletion src/guidance/turn_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <boost/assert.hpp>
#include <boost/optional.hpp>

using osrm::guidance::getTurnDirection;
using osrm::util::angularDeviation;

namespace
Expand Down
3 changes: 0 additions & 3 deletions src/partitioner/partitioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
#include <boost/filesystem/operations.hpp>
#include <tbb/global_control.h>

#include "util/geojson_debug_logger.hpp"
#include "util/geojson_debug_policies.hpp"
#include "util/json_container.hpp"
#include "util/timing_util.hpp"

namespace osrm
Expand Down
2 changes: 1 addition & 1 deletion src/server/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ std::vector<char> Connection::compress_buffers(const std::vector<char> &uncompre
boost::iostreams::filtering_ostream gzip_stream;
gzip_stream.push(boost::iostreams::gzip_compressor(compression_parameters));
gzip_stream.push(boost::iostreams::back_inserter(compressed_data));
gzip_stream.write(&uncompressed_data[0], uncompressed_data.size());
gzip_stream.write(uncompressed_data.data(), uncompressed_data.size());
boost::iostreams::close(gzip_stream);

return compressed_data;
Expand Down

0 comments on commit 57f7c15

Please sign in to comment.