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