Sponsored Content
Skip to content

chore: Enable clang-tidy bugprone-move-forwarding-reference check - #6457

Merged
bthomee merged 2 commits into
XRPLF:developfrom
godexsoft:chore/clang-tidy-checks-move-forwarding-reference
Mar 4, 2026
Merged

chore: Enable clang-tidy bugprone-move-forwarding-reference check#6457
bthomee merged 2 commits into
XRPLF:developfrom
godexsoft:chore/clang-tidy-checks-move-forwarding-reference

Conversation

@godexsoft

Copy link
Copy Markdown
Contributor

High Level Overview of Change

This PR enables clang-tidy bugprone-move-forwarding-reference check.

Context of Change

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Performance (increase or change in throughput and/or latency)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)
  • Documentation update
  • Chore (no impact to binary, e.g. .gitignore, formatting, dropping support for older tooling)
  • Release

API Impact

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change (in general, breaking changes should only impact the next api_version)
  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)
  • Peer protocol change (must be backward compatible or bump the peer protocol version)

@godexsoft godexsoft added DraftRunCI Normally CI does not run on draft PRs. This opts in. and removed DraftRunCI Normally CI does not run on draft PRs. This opts in. labels Mar 3, 2026
@godexsoft
godexsoft marked this pull request as ready for review March 3, 2026 14:46
Copilot AI review requested due to automatic review settings March 3, 2026 14:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enables the clang-tidy bugprone-move-forwarding-reference check and updates a unit test to avoid triggering the new diagnostic.

Changes:

  • Enable bugprone-move-forwarding-reference in the repository’s .clang-tidy configuration.
  • Adjust a requires-based negative compile-time test in MultiApiJson_test.cpp to avoid moving a forwarding reference.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/test/protocol/MultiApiJson_test.cpp Updates a static_assert/requires test case that previously used std::move on a forwarding reference.
.clang-tidy Enables the bugprone-move-forwarding-reference check.
Comments suppressed due to low confidence (1)

src/test/protocol/MultiApiJson_test.cpp:560

  • decltype(v){} here tries to value-initialize decltype(v), but in this lambda v is deduced as an lvalue reference (MultiApiJson<...>&), so decltype(v) is a reference type and cannot be constructed. That makes the requires fail for the wrong reason, weakening the intent of the test ("cannot bind rvalue"). Prefer creating an rvalue of the underlying object type without construction, e.g. using std::declval<std::remove_reference_t<decltype(v)>>() in the requirement, or keep std::move(v) with a targeted NOLINT since this is intentional in an unevaluated requires context.
                    v.visitor(
                        decltype(v){},  // cannot bind rvalue
                        1,

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Mar 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.8%. Comparing base (e39954d) to head (bc1e575).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #6457   +/-   ##
=======================================
  Coverage     79.8%   79.8%           
=======================================
  Files          858     858           
  Lines        67766   67766           
  Branches      7554    7547    -7     
=======================================
+ Hits         54078   54093   +15     
+ Misses       13688   13673   -15     

see 5 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@godexsoft godexsoft added Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. Trivial Simple change with minimal effect, or already tested. Only needs one approval. labels Mar 4, 2026
@bthomee
bthomee enabled auto-merge (squash) March 4, 2026 16:19
@bthomee
bthomee merged commit af97df5 into XRPLF:develop Mar 4, 2026
3 checks passed
@mvadari mvadari added this to the 3.2.0 milestone May 20, 2026
beartec-jpg pushed a commit to beartec-jpg/FalconLedger that referenced this pull request Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. Trivial Simple change with minimal effect, or already tested. Only needs one approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants