fix more clang tidy errors

This commit is contained in:
antoniofilipovic 2022-08-21 13:52:54 +02:00
parent 929e9433ea
commit d201e69679
4 changed files with 35 additions and 8 deletions

View File

@ -71,7 +71,8 @@ storage::Result<EdgeAccessor> SubgraphDbAccessor::InsertEdge(SubgraphVertexAcces
}
storage::Result<std::optional<std::pair<VertexAccessor, std::vector<EdgeAccessor>>>>
SubgraphDbAccessor::DetachRemoveVertex(VertexAccessor *) {
SubgraphDbAccessor::DetachRemoveVertex(
VertexAccessor *) { // NOLINT(hicpp-named-parameter, readability-convert-member-functions-to-static)
throw std::logic_error{"Such operation not possible on subgraph"};
}
@ -91,7 +92,9 @@ SubgraphVertexAccessor SubgraphDbAccessor::InsertVertex() {
return SubgraphVertexAccessor(vertex, this->getGraph());
}
VerticesIterable SubgraphDbAccessor::Vertices(storage::View) { return VerticesIterable(graph_->vertices()); }
VerticesIterable SubgraphDbAccessor::Vertices(storage::View) {
return VerticesIterable(graph_->vertices());
} // NOLINT(hicpp-named-parameter)
std::optional<VertexAccessor> SubgraphDbAccessor::FindVertex(storage::Gid gid, storage::View view) {
std::optional<VertexAccessor> maybe_vertex = db_accessor_->FindVertex(gid, view);

View File

@ -21,6 +21,11 @@ Graph::Graph(const Graph &other, utils::MemoryResource *memory)
Graph::Graph(Graph &&other) noexcept : Graph(std::move(other), other.GetMemoryResource()) {}
Graph::Graph(const Graph &other)
: Graph(other,
std::allocator_traits<allocator_type>::select_on_container_copy_construction(other.GetMemoryResource())
.GetMemoryResource()) {}
Graph::Graph(Graph &&other, utils::MemoryResource *memory)
: vertices_(std::move(other.vertices_), memory), edges_(std::move(other.edges_), memory) {}
@ -36,10 +41,7 @@ void Graph::InsertVertex(const VertexAccessor &vertex) { vertices_.insert(vertex
void Graph::InsertEdge(const EdgeAccessor &edge) { edges_.insert(edge); }
bool Graph::ContainsVertex(const VertexAccessor &vertex) {
if (std::find(begin(vertices_), end(vertices_), vertex) != std::end(vertices_)) {
return true;
}
return false;
return std::find(begin(vertices_), end(vertices_), vertex) != std::end(vertices_);
}
std::optional<VertexAccessor> Graph::RemoveVertex(const VertexAccessor &vertex) {
@ -75,7 +77,7 @@ std::vector<EdgeAccessor> Graph::OutEdges(VertexAccessor vertex_accessor) {
Graph &Graph::operator=(const Graph &) = default;
/** Move assign other, utils::MemoryResource of `this` is used. */
Graph &Graph::operator=(Graph &&) = default;
Graph &Graph::operator=(Graph &&) noexcept = default;
Graph::~Graph() = default;

View File

@ -37,6 +37,16 @@ class Graph final {
*/
explicit Graph(utils::MemoryResource *memory);
/**
* Construct a copy of other.
* utils::MemoryResource is obtained by calling
* std::allocator_traits<>::
* select_on_container_copy_construction(other.GetMemoryResource()).
* Since we use utils::Allocator, which does not propagate, this means that we
* will default to utils::NewDeleteResource().
*/
Graph(const Graph &other);
/** Construct a copy using the given utils::MemoryResource */
Graph(const Graph &other, utils::MemoryResource *memory);
@ -57,19 +67,30 @@ class Graph final {
/** Expands the graph with the given path. */
void Expand(const Path &path);
/** Inserts the vertex in the graph. */
void InsertVertex(const VertexAccessor &vertex);
/** Inserts the edge in the graph. */
void InsertEdge(const EdgeAccessor &edge);
/** Checks whether the graph contains the vertex. */
bool ContainsVertex(const VertexAccessor &vertex);
/** Removes the vertex from the graph if the vertex is in the graph. */
std::optional<VertexAccessor> RemoveVertex(const VertexAccessor &vertex);
/** Removes the vertex from the graph if the vertex is in the graph. */
std::optional<EdgeAccessor> RemoveEdge(const EdgeAccessor &edge);
/** Return the out edges of the given vertex. */
std::vector<EdgeAccessor> OutEdges(VertexAccessor vertex_accessor);
/** Copy assign other, utils::MemoryResource of `this` is used */
Graph &operator=(const Graph &);
/** Move assign other, utils::MemoryResource of `this` is used. */
Graph &operator=(Graph &&);
Graph &operator=(Graph &&) noexcept;
~Graph();

View File

@ -2913,6 +2913,7 @@ class AggregateCursor : public Cursor {
/** Checks if the given TypedValue is legal in PROJECT and PROJECT_TRANSITIVE. If not
* an appropriate exception is thrown. */
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
void EnsureOkForProject(const TypedValue &value) const {
switch (value.type()) {
case TypedValue::Type::Path: