Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/common/clang-tidy.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Checks": "-*, bugprone-*, -bugprone-easily-swappable-parameters,-bugprone-unchecked-optional-access, concurrency-*, cppcoreguidelines-avoid-const-or-ref-data-members, modernize-*, performance-*, portability-*",
"Checks": "-*, bugprone-*, -bugprone-easily-swappable-parameters,-bugprone-unchecked-optional-access, concurrency-*, cppcoreguidelines-rvalue-reference-param-not-moved,cppcoreguidelines-avoid-const-or-ref-data-members, modernize-*, performance-*, portability-*",
"WarningsAsErrors": "*",
"FormatStyle": "none",
"UseColor": true
Expand Down
2 changes: 1 addition & 1 deletion src/core/json/include/sourcemeta/core/json_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ template <typename Key, typename Value, typename Hash> class JSONObject {
}
}

this->data.push_back({key, value, key_hash});
this->data.push_back({std::move(key), value, key_hash});
return key_hash;
}

Expand Down
1 change: 1 addition & 0 deletions src/core/json/json_value.cc
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,7 @@ auto JSON::assign(const JSON::String &key, const JSON &value) -> void {
this->data_object.emplace(key, value);
}

// NOLINTNEXTLINE(cppcoreguidelines-rvalue-reference-param-not-moved)
auto JSON::assign(const JSON::String &key, JSON &&value) -> void {
assert(this->is_object());
this->data_object.emplace(key, value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this->data_object.emplace(key, value);
this->data_object.emplace(key, std::move(value));

Maybe what it wants is this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but that would conflict with another rule saying that move is ineffective

error: passing result of std::move() as a const reference argument; no move will actually happen [performance-move-const-arg,-warnings-as-errors]
  805 |   this->data_object.emplace(key, std::move(value));
      |                                  ^~~~~~~~~~     ~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, OK

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ template <typename PropertyT, typename Hash> class GenericPointer {
}

this->reserve(this->data.size() + other.size());
std::move(other.data.begin(), other.data.end(),
std::move(other.data.begin(), std::move(other).data.end(),
std::back_inserter(this->data));
}

Expand Down
Loading