2016-12-18 00:35:53 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "NoExplicitMoveConstructorChecker.h"
|
|
|
|
#include "CustomMatchers.h"
|
|
|
|
|
2017-10-20 20:11:50 +03:00
|
|
|
void NoExplicitMoveConstructorChecker::registerMatchers(
|
|
|
|
MatchFinder *AstMatcher) {
|
2016-12-18 05:14:37 +03:00
|
|
|
AstMatcher->addMatcher(
|
2017-10-20 20:11:50 +03:00
|
|
|
cxxConstructorDecl(isExplicitMoveConstructor()).bind("node"), this);
|
2016-12-18 00:35:53 +03:00
|
|
|
}
|
|
|
|
|
2016-12-18 05:14:37 +03:00
|
|
|
void NoExplicitMoveConstructorChecker::check(
|
2016-12-18 00:35:53 +03:00
|
|
|
const MatchFinder::MatchResult &Result) {
|
|
|
|
// Everything we needed to know was checked in the matcher - we just report
|
|
|
|
// the error here
|
|
|
|
const CXXConstructorDecl *D =
|
|
|
|
Result.Nodes.getNodeAs<CXXConstructorDecl>("node");
|
|
|
|
|
2016-12-18 05:14:37 +03:00
|
|
|
diag(D->getLocation(), "Move constructors may not be marked explicit",
|
|
|
|
DiagnosticIDs::Error);
|
2016-12-18 00:35:53 +03:00
|
|
|
}
|