Skip to content

Commit 8284612

Browse files
committed
(hopefully) fix ci
don't warn on deleted move & fix compilation error on linux
1 parent 9280db3 commit 8284612

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include "ExplicitMoveConstructorCheck.h"
1010
#include "clang/ASTMatchers/ASTMatchFinder.h"
11-
#include "clang/Lex/lexer.h"
11+
#include "clang/Lex/Lexer.h"
1212

1313
using namespace clang::ast_matchers;
1414

@@ -39,7 +39,8 @@ static SourceRange findExplicitToken(const CXXConstructorDecl *Ctor,
3939
void ExplicitMoveConstructorCheck::registerMatchers(MatchFinder *Finder) {
4040
Finder->addMatcher(
4141
cxxRecordDecl(
42-
has(cxxConstructorDecl(isMoveConstructor(), isExplicit())
42+
has(cxxConstructorDecl(isMoveConstructor(), isExplicit(),
43+
unless(isDeleted()))
4344
.bind("move-ctor")),
4445
has(cxxConstructorDecl(isCopyConstructor(), unless(isDeleted()))
4546
.bind("copy-ctor"))),
@@ -56,9 +57,9 @@ void ExplicitMoveConstructorCheck::check(
5657
if (!MoveCtor || !CopyCtor)
5758
return;
5859

59-
auto Diag = diag(
60-
MoveCtor->getLocation(),
61-
"copy constructor may be called instead of move constructor");
60+
auto Diag =
61+
diag(MoveCtor->getLocation(),
62+
"copy constructor may be called instead of move constructor");
6263
SourceRange ExplicitTokenRange =
6364
findExplicitToken(MoveCtor, *Result.SourceManager, getLangOpts());
6465

clang-tools-extra/test/clang-tidy/checkers/performance/explicit-move-constructor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ class Reported {
2929
public:
3030
explicit Reported(Reported&&) = default;
3131
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: copy constructor may be called instead of move constructor [performance-explicit-move-constructor]
32-
// CHECK-FIXES: {{^}}Reported(Reported&&) = default;{{$}}
32+
// CHECK-FIXES: {{^ }}Reported(Reported&&) = default;{{$}}
3333
Reported(const Reported&) = default;
3434
};

0 commit comments

Comments
 (0)