Skip to content

Fix unnecessary string copies in verify tests - #622

Open
stefanatwork wants to merge 3 commits into
masterfrom
fix/coverity-string-moves
Open

Fix unnecessary string copies in verify tests#622
stefanatwork wants to merge 3 commits into
masterfrom
fix/coverity-string-moves

Conversation

@stefanatwork

@stefanatwork stefanatwork commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Apply move-aware string forwarding in verify test constructors
Resolve Coverity COPY_INSTEAD_OF_MOVE findings

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 addresses Coverity COPY_INSTEAD_OF_MOVE findings in the verify tutorial tests by making string construction/forwarding move-aware, reducing unnecessary std::string copies in test constructors.

Changes:

  • Add <utility> to support std::move in the verify test header.
  • Move std::string constructor parameters into stored members (e.g., Test::name) instead of copying.
  • Forward std::string parameters via std::move from derived test constructors into base Test/IntersectTest constructors (and similarly move other string parameters like model / tri_accel).

Reviewed changes

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

File Description
tutorials/verify/verify.h Uses std::move to construct/store test names without extra copies; adds <utility>.
tutorials/verify/verify.cpp Updates many verify test constructors to move-forward std::string parameters into base classes / members.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@stefanatwork
stefanatwork force-pushed the fix/coverity-string-moves branch from 108af5f to f8ae7a7 Compare August 19, 2026 15:29
stefanatwork and others added 2 commits August 19, 2026 18:01
Found via clang-tidy (performance-unnecessary-value-param,
performance-move-const-arg, modernize-pass-by-value):

- Pass Benchmark's name/unit by value and move into members instead of
  copying, and forward name via std::move in SimpleBenchmark,
  ParallelIntersectBenchmark and CreateGeometryBenchmark.
- Move name into TestGroup's base Test constructor instead of copying.
- Change parameters that are only read (never moved) to const
  references: TestGroup::add, TestGroup::extend_prefix,
  prefix_test_names, enable_disable_all_tests,
  enable_disable_some_tests's test param, plot's outFileName/xlabel,
  regex_match, and command-line option lambdas that don't consume cin.
- Forward cin via std::move where it is passed on by value exactly
  once (plot-over-primitives/plot-over-threads).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants