Bug 1814798 - pt 1. Add bool to enable/disable PHC at runtime r=glandium
[gecko.git] / build / clang-plugin / NoUsingNamespaceMozillaJavaChecker.cpp
blob20449dba92a366485cbdfc7d4d4c0a5c58780534
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 "NoUsingNamespaceMozillaJavaChecker.h"
6 #include "CustomMatchers.h"
8 void NoUsingNamespaceMozillaJavaChecker::registerMatchers(
9 MatchFinder *AstMatcher) {
10 AstMatcher->addMatcher(
11 usingDirectiveDecl(isUsingNamespaceMozillaJava()).bind("directive"),
12 this);
15 void NoUsingNamespaceMozillaJavaChecker::check(
16 const MatchFinder::MatchResult &Result) {
17 const UsingDirectiveDecl *Directive =
18 Result.Nodes.getNodeAs<UsingDirectiveDecl>("directive");
19 const NamespaceDecl *Namespace = Directive->getNominatedNamespace();
21 diag(Directive->getUsingLoc(), "using namespace %0 is forbidden",
22 DiagnosticIDs::Error)
23 << Namespace->getQualifiedNameAsString();