tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

OverrideBaseCallUsageChecker.cpp (798B)


      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 "OverrideBaseCallUsageChecker.h"
      6 #include "CustomMatchers.h"
      7 
      8 void OverrideBaseCallUsageChecker::registerMatchers(MatchFinder *AstMatcher) {
      9  AstMatcher->addMatcher(
     10      cxxMethodDecl(isNonVirtual(), isRequiredBaseMethod()).bind("method"),
     11      this);
     12 }
     13 
     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");
     19 
     20  diag(Method->getLocation(), Error, DiagnosticIDs::Error);
     21 }