Skip to content

Commit 67790b8

Browse files
committed
invert logic
1 parent 777eacd commit 67790b8

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

clang-tools-extra/clang-tidy/performance/LostStdMoveCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void LostStdMoveCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
8585

8686
LostStdMoveCheck::LostStdMoveCheck(StringRef Name, ClangTidyContext *Context)
8787
: ClangTidyCheck(Name, Context),
88-
StrictMode(Options.get("StrictMode", true)) {}
88+
StrictMode(Options.get("StrictMode", false)) {}
8989

9090
void LostStdMoveCheck::registerMatchers(MatchFinder *Finder) {
9191
auto ReturnParent =
@@ -132,7 +132,7 @@ void LostStdMoveCheck::check(const MatchFinder::MatchResult &Result) {
132132
return;
133133
}
134134

135-
if (StrictMode) {
135+
if (!StrictMode) {
136136
llvm::SmallPtrSet<const VarDecl *, 16> AllVarDecls =
137137
allVarDeclsExprs(*MatchedDecl, *MatchedFunc, *Result.Context);
138138
if (!AllVarDecls.empty()) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ Also it does notice variable references "behind the scenes":
2727
void g(X x) {
2828
auto &y = x;
2929
f(x); // does not emit a warning
30-
y.f(); // because is still used
30+
y.f(); // because x is still used via y
3131
}
3232

3333
If you want to ignore assigns to reference variables, set ::option::
34-
`StrictMode` to `false`.
34+
`StrictMode` to `true`.
3535

3636

3737
Options
@@ -45,4 +45,4 @@ Options
4545
references ``X``, then it will not emit a warning for ``X`` not to provoke
4646
false positive. If you're sure that such references don't extend ``X``
4747
lifetime and ready to handle possible false positives, then set `StrictMode`
48-
to `false`. Defaults to `true`.
48+
to `true`. Defaults to `false`.

clang-tools-extra/test/clang-tidy/checkers/performance/lost-std-move-nonstrict.cpp renamed to clang-tools-extra/test/clang-tidy/checkers/performance/lost-std-move-strict.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %check_clang_tidy %s performance-lost-std-move %t -- -config='{CheckOptions: {performance-lost-std-move.StrictMode: false}}'
1+
// RUN: %check_clang_tidy %s performance-lost-std-move %t -- -config='{CheckOptions: {performance-lost-std-move.StrictMode: true}}'
22

33
namespace std {
44

0 commit comments

Comments
 (0)