Bug 1795793 [wpt PR 36510] - Add meta timeout=long to charset-parameter test, a=testonly
[gecko.git] / build / clang-plugin / NoPrincipalGetURI.cpp
blob60e22abeb5940fa12df025aa2fede3eb9000a9f7
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(hasCanonicalType(asString("class nsIPrincipal *")))),
14 on(hasType(hasCanonicalType(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);