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/. */
5 #include "NoAutoTypeChecker.h"
6 #include "CustomMatchers.h"
8 void NoAutoTypeChecker::registerMatchers(MatchFinder
*AstMatcher
) {
9 AstMatcher
->addMatcher(varDecl(hasType(autoNonAutoableType())).bind("node"),
13 void NoAutoTypeChecker::check(const MatchFinder::MatchResult
&Result
) {
14 const VarDecl
*D
= Result
.Nodes
.getNodeAs
<VarDecl
>("node");
16 diag(D
->getLocation(), "Cannot use auto to declare a variable of type %0",
19 diag(D
->getLocation(), "Please write out this type explicitly",