Update CI to use clang-tidy 14 (#6353)

This commit is contained in:
Siarhei Fedartsou 2022-08-31 23:39:47 +02:00 committed by GitHub
parent c003ac1055
commit 96f5780f06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 24 additions and 35 deletions

View File

@ -12,6 +12,7 @@ Checks: >
-bugprone-unhandled-self-assignment, -bugprone-unhandled-self-assignment,
-bugprone-forward-declaration-namespace, -bugprone-forward-declaration-namespace,
-bugprone-sizeof-expression, -bugprone-sizeof-expression,
-bugprone-throw-keyword-missing,
-clang-analyzer-*, -clang-analyzer-*,
-clang-diagnostic-deprecated-declarations, -clang-diagnostic-deprecated-declarations,
-clang-diagnostic-constant-conversion, -clang-diagnostic-constant-conversion,
@ -64,6 +65,7 @@ Checks: >
-readability-else-after-return, -readability-else-after-return,
-readability-inconsistent-declaration-parameter-name, -readability-inconsistent-declaration-parameter-name,
-readability-isolate-declaration, -readability-isolate-declaration,
-readability-identifier-length,
-readability-redundant-declaration, -readability-redundant-declaration,
-readability-uppercase-literal-suffix, -readability-uppercase-literal-suffix,
-readability-named-parameter, -readability-named-parameter,

View File

@ -145,11 +145,11 @@ jobs:
- name: clang-11.0-debug-clang-tidy - name: clang-11.0-debug-clang-tidy
continue-on-error: false continue-on-error: false
node: 12 node: 12
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
BUILD_TOOLS: ON BUILD_TOOLS: ON
BUILD_TYPE: Debug BUILD_TYPE: Debug
CCOMPILER: clang-11 CCOMPILER: clang-14
CXXCOMPILER: clang++-11 CXXCOMPILER: clang++-14
CUCUMBER_TIMEOUT: 60000 CUCUMBER_TIMEOUT: 60000
ENABLE_CLANG_TIDY: ON ENABLE_CLANG_TIDY: ON

View File

@ -32,6 +32,8 @@ namespace api
class TableAPI final : public BaseAPI class TableAPI final : public BaseAPI
{ {
public: public:
virtual ~TableAPI() = default;
struct TableCellRef struct TableCellRef
{ {
TableCellRef(const std::size_t &row, const std::size_t &column) : row{row}, column{column} TableCellRef(const std::size_t &row, const std::size_t &column) : row{row}, column{column}

View File

@ -31,6 +31,8 @@ template <> class AlgorithmDataFacade<CH>
using EdgeData = contractor::QueryEdge::EdgeData; using EdgeData = contractor::QueryEdge::EdgeData;
using EdgeRange = util::filtered_range<EdgeID, util::vector_view<bool>>; using EdgeRange = util::filtered_range<EdgeID, util::vector_view<bool>>;
virtual ~AlgorithmDataFacade() = default;
// search graph access // search graph access
virtual unsigned GetNumberOfNodes() const = 0; virtual unsigned GetNumberOfNodes() const = 0;
@ -66,6 +68,8 @@ template <> class AlgorithmDataFacade<MLD>
using EdgeData = customizer::EdgeBasedGraphEdgeData; using EdgeData = customizer::EdgeBasedGraphEdgeData;
using EdgeRange = util::range<EdgeID>; using EdgeRange = util::range<EdgeID>;
virtual ~AlgorithmDataFacade() = default;
// search graph access // search graph access
virtual unsigned GetNumberOfNodes() const = 0; virtual unsigned GetNumberOfNodes() const = 0;

View File

@ -19,6 +19,8 @@ namespace engine
class RoutingAlgorithmsInterface class RoutingAlgorithmsInterface
{ {
public: public:
virtual ~RoutingAlgorithmsInterface() = default;
virtual InternalManyRoutesResult virtual InternalManyRoutesResult
AlternativePathSearch(const PhantomEndpointCandidates &endpoint_candidates, AlternativePathSearch(const PhantomEndpointCandidates &endpoint_candidates,
unsigned number_of_alternatives) const = 0; unsigned number_of_alternatives) const = 0;

View File

@ -58,7 +58,7 @@ class RasterGrid
for (unsigned int y = 0; y < ydim; y++) for (unsigned int y = 0; y < ydim; y++)
{ {
// read one line from file. // read one line from file.
file_reader.ReadLine(&buffer[0], xdim * 11); file_reader.ReadLine(buffer.data(), xdim * 11);
boost::algorithm::trim(buffer); boost::algorithm::trim(buffer);
std::vector<std::string> result; std::vector<std::string> result;

View File

@ -125,13 +125,13 @@ template <typename NodeEntryT, typename EdgeEntryT> class RemappableGraph
NodeID GetID(const NodeT &node) const NodeID GetID(const NodeT &node) const
{ {
BOOST_ASSERT(&node >= &nodes[0] && &node <= &nodes.back()); BOOST_ASSERT(&node >= nodes.data() && &node <= &nodes.back());
return (&node - &nodes[0]); return (&node - nodes.data());
} }
EdgeID GetID(const EdgeT &edge) const EdgeID GetID(const EdgeT &edge) const
{ {
BOOST_ASSERT(&edge >= &edges[0] && &edge <= &edges.back()); BOOST_ASSERT(&edge >= edges.data() && &edge <= &edges.back());
return (&edge - &edges[0]); return (&edge - edges.data());
} }
NodeIterator Begin() { return nodes.begin(); } NodeIterator Begin() { return nodes.begin(); }
@ -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 // removes the edges from the graph that return true for the filter, returns new end
template <typename FilterT> auto RemoveEdges(NodeT &node, FilterT filter) 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 // 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 negate_filter = [&](const EdgeT &edge) { return !filter(edge); };
const auto center = std::stable_partition(BeginEdges(node), EndEdges(node), negate_filter); const auto center = std::stable_partition(BeginEdges(node), EndEdges(node), negate_filter);

View File

@ -36,9 +36,6 @@
#include "util/vector_view.hpp" #include "util/vector_view.hpp"
#include "util/filtered_graph.hpp" #include "util/filtered_graph.hpp"
#include "util/packed_vector.hpp"
#include "util/vector_view.hpp"
namespace osrm namespace osrm
{ {
namespace storage namespace storage

View File

@ -25,7 +25,7 @@ template <typename T> class DistTableWrapper
DistTableWrapper(std::vector<T> table, std::size_t number_of_nodes) DistTableWrapper(std::vector<T> table, std::size_t number_of_nodes)
: table_(std::move(table)), number_of_nodes_(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(), BOOST_ASSERT_MSG(number_of_nodes_ * number_of_nodes_ <= table_.size(),
"number_of_nodes_ is invalid"); "number_of_nodes_ is invalid");
} }

View File

@ -126,8 +126,8 @@ class FilteredGraphImpl<util::StaticGraph<EdgeDataT, Ownership>, Ownership>
FilteredGraphImpl() = default; FilteredGraphImpl() = default;
FilteredGraphImpl(Graph graph, Vector<bool> edge_filter_) FilteredGraphImpl(Graph graph_, Vector<bool> edge_filter_)
: graph(std::move(graph)), edge_filter(std::move(edge_filter_)) : graph(std::move(graph_)), edge_filter(std::move(edge_filter_))
{ {
BOOST_ASSERT(edge_filter.empty() || edge_filter.size() == graph.GetNumberOfEdges()); BOOST_ASSERT(edge_filter.empty() || edge_filter.size() == graph.GetNumberOfEdges());
} }

View File

@ -39,7 +39,7 @@ MMapMemoryAllocator::MMapMemoryAllocator(const storage::StorageConfig &config)
// prior to C++17 (which we're not using), those return a `const char *`, // prior to C++17 (which we're not using), those return a `const char *`,
// which isn't compatible with the `char *` that AllocatedRegion expects // which isn't compatible with the `char *` that AllocatedRegion expects
// for it's memory_ptr // 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(); auto files = storage.GetStaticFiles();

View File

@ -15,8 +15,6 @@
#include <boost/numeric/conversion/cast.hpp> #include <boost/numeric/conversion/cast.hpp>
#include <boost/range/iterator_range.hpp> #include <boost/range/iterator_range.hpp>
#include "engine/guidance/collapsing_utility.hpp"
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <cstddef> #include <cstddef>

View File

@ -11,8 +11,6 @@
#include "util/bearing.hpp" #include "util/bearing.hpp"
#include "util/coordinate_calculation.hpp" #include "util/coordinate_calculation.hpp"
using osrm::util::angularDeviation;
namespace osrm namespace osrm
{ {
namespace extractor namespace extractor

View File

@ -7,13 +7,11 @@
#include "util/log.hpp" #include "util/log.hpp"
#include "util/bearing.hpp" #include "util/bearing.hpp"
#include "util/coordinate_calculation.hpp"
#include <algorithm> #include <algorithm>
#include <cstddef> #include <cstddef>
using EdgeData = osrm::util::NodeBasedDynamicGraph::EdgeData; using EdgeData = osrm::util::NodeBasedDynamicGraph::EdgeData;
using osrm::guidance::getTurnDirection;
using osrm::util::angularDeviation; using osrm::util::angularDeviation;
namespace osrm namespace osrm

View File

@ -11,7 +11,6 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>
using osrm::guidance::getTurnDirection;
using osrm::util::angularDeviation; using osrm::util::angularDeviation;
namespace osrm namespace osrm

View File

@ -15,8 +15,6 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>
using osrm::guidance::getTurnDirection;
namespace osrm namespace osrm
{ {
namespace guidance namespace guidance

View File

@ -6,8 +6,6 @@
#include "util/coordinate_calculation.hpp" #include "util/coordinate_calculation.hpp"
#include <set> #include <set>
using osrm::guidance::getTurnDirection;
namespace osrm namespace osrm
{ {
namespace guidance namespace guidance

View File

@ -12,7 +12,6 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>
using osrm::guidance::getTurnDirection;
using osrm::util::angularDeviation; using osrm::util::angularDeviation;
namespace osrm namespace osrm

View File

@ -10,8 +10,6 @@
#include <unordered_set> #include <unordered_set>
#include <utility> #include <utility>
using osrm::guidance::getTurnDirection;
namespace osrm namespace osrm
{ {
namespace guidance namespace guidance

View File

@ -11,7 +11,6 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
using osrm::guidance::getTurnDirection;
using osrm::util::angularDeviation; using osrm::util::angularDeviation;
namespace namespace

View File

@ -29,9 +29,6 @@
#include <boost/filesystem/operations.hpp> #include <boost/filesystem/operations.hpp>
#include <tbb/global_control.h> #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" #include "util/timing_util.hpp"
namespace osrm namespace osrm

View File

@ -239,7 +239,7 @@ std::vector<char> Connection::compress_buffers(const std::vector<char> &uncompre
boost::iostreams::filtering_ostream gzip_stream; boost::iostreams::filtering_ostream gzip_stream;
gzip_stream.push(boost::iostreams::gzip_compressor(compression_parameters)); gzip_stream.push(boost::iostreams::gzip_compressor(compression_parameters));
gzip_stream.push(boost::iostreams::back_inserter(compressed_data)); 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); boost::iostreams::close(gzip_stream);
return compressed_data; return compressed_data;