Bug 1776444 [wpt PR 34582] - Revert "Add TimedHTMLParserBudget to fieldtrial_testing_...
[gecko.git] / build / clang-plugin / NoPrincipalGetURI.cpp
blob2f3774b33111cd7fb8aa1c3e2698ea215b6c2d64
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 "NoPrincipalGetURI.h"
6 #include "CustomMatchers.h"
8 void NoPrincipalGetURI::registerMatchers(MatchFinder *AstMatcher) {
10 AstMatcher->addMatcher(
11 cxxMemberCallExpr(
12 allOf(callee(cxxMethodDecl(hasName("GetURI"))),
13 anyOf(on(hasType(asString("class nsIPrincipal *"))),
14 on(hasType(asString("class nsIPrincipal")))),
15 unless(isInWhiteListForPrincipalGetUri())),
16 argumentCountIs(1))
17 .bind("id"),
18 this);
21 void NoPrincipalGetURI::check(const MatchFinder::MatchResult &Result) {
22 const auto *MatchedDecl = Result.Nodes.getNodeAs<CXXMemberCallExpr>("id");
23 diag(MatchedDecl->getExprLoc(),
24 "Principal->GetURI is deprecated and will be removed soon. Please "
25 "consider using the new helper functions of nsIPrincipal",
26 DiagnosticIDs::Error);