Source code

Revision control

Other Tools

1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
#include "NoExplicitMoveConstructorChecker.h"
6
#include "CustomMatchers.h"
7
8
void NoExplicitMoveConstructorChecker::registerMatchers(
9
MatchFinder *AstMatcher) {
10
AstMatcher->addMatcher(
11
cxxConstructorDecl(isExplicitMoveConstructor()).bind("node"), this);
12
}
13
14
void NoExplicitMoveConstructorChecker::check(
15
const MatchFinder::MatchResult &Result) {
16
// Everything we needed to know was checked in the matcher - we just report
17
// the error here
18
const CXXConstructorDecl *D =
19
Result.Nodes.getNodeAs<CXXConstructorDecl>("node");
20
21
diag(D->getLocation(), "Move constructors may not be marked explicit",
22
DiagnosticIDs::Error);
23
}