A string or container parameter is taken by value and only read, so every call copies it for nothing
What it finds
A std::string, std::vector, map or set passed by value is copied at each call. When the function only reads it, const T & avoids the copy; when it keeps a copy, taking by value and moving is right, and the rule leaves such parameters alone. Uses counted as reads are calls of size, empty, find and other members that do not change the object, comparisons, output with <<, and subscripts that are not assigned.
From the rule's source, heavy_parameter_copied.rs.
Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/cpp:heavy-parameter-copied" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/cpp:heavy-parameter-copied] reason="..."tx0 explain tx0/cpp:heavy-parameter-copied shows the same in the terminal. Found a false positive? Report it.