Skip to content

Commit eade13f

Browse files
authored
style(clang-tidy): fix modernize-pass-by-value checks (#1807)
Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
1 parent 9e48623 commit eade13f

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

src/core/json/include/sourcemeta/core/json_error.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,15 @@ class SOURCEMETA_CORE_JSON_EXPORT JSONParseIntegerLimitError
7070
class SOURCEMETA_CORE_JSON_EXPORT JSONFileParseError : public JSONParseError {
7171
public:
7272
/// Create a file parsing error
73-
JSONFileParseError(const std::filesystem::path &path,
74-
const std::uint64_t line, const std::uint64_t column,
75-
std::string message)
76-
: JSONParseError{line, column, std::move(message)}, path_{path} {}
73+
JSONFileParseError(std::filesystem::path path, const std::uint64_t line,
74+
const std::uint64_t column, std::string message)
75+
: JSONParseError{line, column, std::move(message)},
76+
path_{std::move(path)} {}
7777

7878
/// Create a file parsing error from a parse error
79-
JSONFileParseError(const std::filesystem::path &path,
80-
const JSONParseError &parent)
79+
JSONFileParseError(std::filesystem::path path, const JSONParseError &parent)
8180
: JSONParseError{parent.line(), parent.column(), parent.what()},
82-
path_{path} {}
81+
path_{std::move(path)} {}
8382

8483
/// Get the file path of the error
8584
[[nodiscard]] auto path() const noexcept -> const std::filesystem::path & {

src/core/jsonpointer/include/sourcemeta/core/jsonpointer_subpointer_walker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ template <typename PointerT> class GenericSubPointerIterator {
5252
template <typename PointerT> class GenericSubPointerWalker {
5353
public:
5454
using const_iterator = GenericSubPointerIterator<PointerT>;
55-
GenericSubPointerWalker(const PointerT &pointer) : data{pointer} {}
55+
GenericSubPointerWalker(PointerT pointer) : data{std::move(pointer)} {}
5656

5757
const_iterator begin() { return {&this->data}; }
5858
const_iterator end() { return {nullptr}; }

src/core/jsonpointer/include/sourcemeta/core/jsonpointer_token.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ template <typename PropertyT, typename Hash> class GenericToken {
1717
/// This constructor creates an JSON Pointer token from a string given its
1818
/// precomputed hash. This is advanced functionality that should be used with
1919
/// care.
20-
GenericToken(const Property &value,
21-
const typename Hash::hash_type property_hash)
22-
: as_property{true}, property{value}, hash{property_hash}, index{0} {}
20+
GenericToken(Property value, const typename Hash::hash_type property_hash)
21+
: as_property{true}, property{std::move(value)}, hash{property_hash},
22+
index{0} {}
2323

2424
/// This constructor creates an JSON Pointer token from a string. For
2525
/// example:

src/core/jsonschema/include/sourcemeta/core/jsonschema_error.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ class SOURCEMETA_CORE_JSONSCHEMA_EXPORT SchemaVocabularyError
7979
class SOURCEMETA_CORE_JSONSCHEMA_EXPORT SchemaReferenceError
8080
: public std::exception {
8181
public:
82-
SchemaReferenceError(std::string identifier, const Pointer &schema_location,
82+
SchemaReferenceError(std::string identifier, Pointer schema_location,
8383
std::string message)
84-
: identifier_{std::move(identifier)}, schema_location_{schema_location},
84+
: identifier_{std::move(identifier)},
85+
schema_location_{std::move(schema_location)},
8586
message_{std::move(message)} {}
8687
[[nodiscard]] auto what() const noexcept -> const char * override {
8788
return this->message_.c_str();

src/core/jsonschema/include/sourcemeta/core/jsonschema_resolver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class SOURCEMETA_CORE_JSONSCHEMA_EXPORT SchemaMapResolver {
4646
SchemaMapResolver();
4747

4848
/// Construct an empty resolver that has another schema resolver as a fallback
49-
SchemaMapResolver(const SchemaResolver &resolver);
49+
SchemaMapResolver(SchemaResolver resolver);
5050

5151
/// Register a schema to the map resolver. Returns whether at least one
5252
/// schema was imported into the resolver

src/core/jsonschema/resolver.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ namespace sourcemeta::core {
77

88
SchemaMapResolver::SchemaMapResolver() = default;
99

10-
SchemaMapResolver::SchemaMapResolver(const SchemaResolver &resolver)
11-
: default_resolver{resolver} {}
10+
SchemaMapResolver::SchemaMapResolver(SchemaResolver resolver)
11+
: default_resolver{std::move(resolver)} {}
1212

1313
auto SchemaMapResolver::add(
1414
const JSON &schema, const std::optional<std::string> &default_dialect,

0 commit comments

Comments
 (0)