Debian Codegraph @

build/clang-plugin/MozillaTidyModule.cpp

raw
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 #ifdef CLANG_TIDY
6
7 #include "../ClangTidy.h"
8 #include "../ClangTidyModule.h"
9 #include "../ClangTidyModuleRegistry.h"
10 #include "ChecksIncludes.inc"
11 #include "external/ExternalIncludes.inc"
12 #ifdef MOZ_CLANG_PLUGIN_ALPHA
13 #include "alpha/AlphaIncludes.inc"
14 #endif
15
16 using namespace clang::ast_matchers;
17
18 namespace clang {
19 namespace tidy {
20
21 class MozillaModule : public ClangTidyModule {
22 public:
23 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
24 #define CHECK(cls, name) CheckFactories.registerCheck<cls>("mozilla-" name);
25 #include "Checks.inc"
26 #include "external/ExternalChecks.inc"
27 #ifdef MOZ_CLANG_PLUGIN_ALPHA
28 #include "alpha/AlphaChecks.inc"
29 #endif
30 #undef CHECK
31 }
32 };
33
34 // Register the MozillaTidyModule using this statically initialized variable.
35 static ClangTidyModuleRegistry::Add<MozillaModule>
36 X("mozilla-module", "Adds Mozilla lint checks.");
37
38 } // namespace tidy
39 } // namespace clang
40
41 // This anchor is used to force the linker to link in the generated object file
42 // and thus register the MozillaModule.
43 volatile int MozillaModuleAnchorSource = 0;
44
45 #endif