Bug 1839316: part 5) Guard the "fetchpriority" attribute behind a pref. r=kershaw...
[gecko.git] / build / clang-plugin / OverrideBaseCallUsageChecker.cpp
blob34b9cd16a9d86a9cad5684058be4945469c5ed73
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 "OverrideBaseCallUsageChecker.h"
6 #include "CustomMatchers.h"
8 void OverrideBaseCallUsageChecker::registerMatchers(MatchFinder *AstMatcher) {
9 AstMatcher->addMatcher(
10 cxxMethodDecl(isNonVirtual(), isRequiredBaseMethod()).bind("method"),
11 this);
14 void OverrideBaseCallUsageChecker::check(
15 const MatchFinder::MatchResult &Result) {
16 const char *Error =
17 "MOZ_REQUIRED_BASE_METHOD can be used only on virtual methods";
18 const CXXMethodDecl *Method = Result.Nodes.getNodeAs<CXXMethodDecl>("method");
20 diag(Method->getLocation(), Error, DiagnosticIDs::Error);