Skip to content

Commit ee844fd

Browse files
committed
option
1 parent 55c4d16 commit ee844fd

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

clang-tools-extra/docs/clang-tidy/checks/performance/lost-std-move.rst

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,31 @@ It honours cycles, lambdas, and unspecified call order in compound expressions.
1717
It finds the last local variable usage, and if it is a copy, emits a warning.
1818
The check is based on pure AST matching and doesn't take into account any
1919
data flow information. Thus, it doesn't catch assign-after-copy cases.
20-
Also it doesn't notice variable references "behind the scenes":
20+
21+
Also it does notice variable references "behind the scenes":
2122

2223
.. code-block:: c++
2324

2425
void f(X);
2526

2627
void g(X x) {
2728
auto &y = x;
28-
f(x); // emits a warning...
29-
y.f(); // ...but it is still used
29+
f(x); // does not emit a warning
30+
y.f(); // because is still used
3031
}
3132

32-
Such rare cases should be silenced using `// NOLINT`.
33+
If you want to ignore assigns to reference variables, set ``StrictMode``
34+
to ``false``.
35+
36+
37+
Options
38+
-------
39+
40+
.. option:: StrictMode
41+
42+
A variable X can be referenced by another variable R. In this case the last
43+
variable usage might be not from X, but from R. It is quite difficult to
44+
find in a large function, so if the plugin sees some R references X, then
45+
it will not emit a warning for X not to provoke false positive. If you're
46+
sure that such references don't extend X' lifetime and ready to handle possible
47+
false positives, then set StrictMode to false.

0 commit comments

Comments
 (0)