xref: /llvm-project/clang-tools-extra/clang-tidy/zircon/ZirconTidyModule.cpp (revision 7d2ea6c422d3f5712b7253407005e1a465a76946)
1b6f7c934SJulie Hockett //===--- ZirconTidyModule.cpp - clang-tidy---------------------------------===//
2b6f7c934SJulie Hockett //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6b6f7c934SJulie Hockett //
7b6f7c934SJulie Hockett //===----------------------------------------------------------------------===//
8b6f7c934SJulie Hockett 
9b6f7c934SJulie Hockett #include "../ClangTidy.h"
10b6f7c934SJulie Hockett #include "../ClangTidyModule.h"
11b6f7c934SJulie Hockett #include "../ClangTidyModuleRegistry.h"
12b6f7c934SJulie Hockett #include "TemporaryObjectsCheck.h"
13b6f7c934SJulie Hockett 
14b6f7c934SJulie Hockett using namespace clang::ast_matchers;
15b6f7c934SJulie Hockett 
16*7d2ea6c4SCarlos Galvez namespace clang::tidy {
17b6f7c934SJulie Hockett namespace zircon {
18b6f7c934SJulie Hockett 
19b6f7c934SJulie Hockett /// This module is for Zircon-specific checks.
20b6f7c934SJulie Hockett class ZirconModule : public ClangTidyModule {
21b6f7c934SJulie Hockett public:
addCheckFactories(ClangTidyCheckFactories & CheckFactories)22b6f7c934SJulie Hockett   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
23b6f7c934SJulie Hockett     CheckFactories.registerCheck<TemporaryObjectsCheck>(
24b6f7c934SJulie Hockett         "zircon-temporary-objects");
25b6f7c934SJulie Hockett   }
26b6f7c934SJulie Hockett };
27b6f7c934SJulie Hockett 
28b6f7c934SJulie Hockett // Register the ZirconTidyModule using this statically initialized variable.
29b6f7c934SJulie Hockett static ClangTidyModuleRegistry::Add<ZirconModule>
30b6f7c934SJulie Hockett     X("zircon-module", "Adds Zircon kernel checks.");
31b6f7c934SJulie Hockett } // namespace zircon
32b6f7c934SJulie Hockett 
33b6f7c934SJulie Hockett // This anchor is used to force the linker to link in the generated object file
34b6f7c934SJulie Hockett // and thus register the ZirconModule.
35b6f7c934SJulie Hockett volatile int ZirconModuleAnchorSource = 0;
36b6f7c934SJulie Hockett 
37*7d2ea6c4SCarlos Galvez } // namespace clang::tidy
38