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(
12 allOf(callee(cxxMethodDecl(hasName("GetURI"))),
13 anyOf(on(hasType(asString("class nsIPrincipal *"))),
14 on(hasType(asString("class nsIPrincipal")))),
15 unless(isInWhiteListForPrincipalGetUri())),
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
);