Skip to content

Commit 5325f2b

Browse files
authored
[clang-tidy][NFC] Enable 'performance-move-const-arg' in '.clang-tidy' config (llvm#148549)
Set `performance-move-const-arg.CheckTriviallyCopyableMove` option to `false` because "trivially copyable" is too strict and give warning for e.g. `MixData` class: https://github.com/llvm/llvm-project/blob/1fbfa333f64bf714efa84db6b1075fc864d53bf8/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp#L389 Here: https://github.com/llvm/llvm-project/blob/1fbfa333f64bf714efa84db6b1075fc864d53bf8/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp#L504-L505 I find `std::move` here useful.
1 parent 69bec0a commit 5325f2b

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

clang-tools-extra/clang-tidy/.clang-tidy

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Checks: >
1616
-modernize-use-trailing-return-type,
1717
performance-*,
1818
-performance-enum-size,
19-
-performance-move-const-arg,
2019
-performance-no-int-to-ptr,
2120
-performance-type-promotion-in-math-fn,
2221
-performance-unnecessary-value-param,
@@ -38,3 +37,7 @@ Checks: >
3837
-readability-static-definition-in-anonymous-namespace,
3938
-readability-suspicious-call-argument,
4039
-readability-use-anyofallof
40+
41+
CheckOptions:
42+
- key: performance-move-const-arg.CheckTriviallyCopyableMove
43+
value: false

clang-tools-extra/clang-tidy/cppcoreguidelines/MissingStdForwardCheck.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ void MissingStdForwardCheck::registerMatchers(MatchFinder *Finder) {
132132
hasAncestor(functionDecl().bind("func")),
133133
hasAncestor(functionDecl(
134134
isDefinition(), equalsBoundNode("func"), ToParam,
135-
unless(anyOf(isDeleted(),
136-
hasDescendant(std::move(ForwardCallMatcher))))))),
135+
unless(anyOf(isDeleted(), hasDescendant(ForwardCallMatcher)))))),
137136
this);
138137
}
139138

clang-tools-extra/clang-tidy/modernize/AvoidCArraysCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void AvoidCArraysCheck::registerMatchers(MatchFinder *Finder) {
6767
hasParent(fieldDecl(
6868
hasParent(recordDecl(isExternCContext())))),
6969
hasAncestor(functionDecl(isExternC())))),
70-
std::move(IgnoreStringArrayIfNeededMatcher))
70+
IgnoreStringArrayIfNeededMatcher)
7171
.bind("typeloc"),
7272
this);
7373
}

clang-tools-extra/clang-tidy/modernize/UseStdNumbersCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ void UseStdNumbersCheck::registerMatchers(MatchFinder *const Finder) {
319319

320320
Finder->addMatcher(
321321
expr(
322-
anyOfExhaustive(std::move(ConstantMatchers)),
322+
anyOfExhaustive(ConstantMatchers),
323323
unless(hasParent(explicitCastExpr(hasDestinationType(isFloating())))),
324324
hasType(qualType(hasCanonicalTypeUnqualified(
325325
anyOf(qualType(asString("float")).bind("float"),

clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) {
149149
}
150150
Finder->addMatcher(
151151
callExpr(
152-
callee(functionDecl(hasAnyName(std::move(Names)))
152+
callee(functionDecl(hasAnyName(Names))
153153
.bind((FuncDecl + Twine(Replacers.size() - 1).str()))),
154154
ast_matchers::internal::DynTypedMatcher::constructVariadic(
155155
ast_matchers::internal::DynTypedMatcher::VO_AnyOf,

0 commit comments

Comments
 (0)