Bug 1857669 - Install libavcodec/libavutil for Selenium tests r=releng-reviewers...
[gecko.git] / build / clang-plugin / NoAutoTypeChecker.cpp
blob937c7c5742fa6f2b1a11464b2eceed81f2de2b20
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"),
10 this);
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",
17 DiagnosticIDs::Error)
18 << D->getType();
19 diag(D->getLocation(), "Please write out this type explicitly",
20 DiagnosticIDs::Note);