File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 88
99#include " ExplicitMoveConstructorCheck.h"
1010#include " clang/ASTMatchers/ASTMatchFinder.h"
11- #include " clang/Lex/lexer .h"
11+ #include " clang/Lex/Lexer .h"
1212
1313using namespace clang ::ast_matchers;
1414
@@ -39,7 +39,8 @@ static SourceRange findExplicitToken(const CXXConstructorDecl *Ctor,
3939void 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
Original file line number Diff line number Diff line change @@ -29,6 +29,6 @@ class Reported {
2929public:
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};
You can’t perform that action at this time.
0 commit comments