xref: /llvm-project/clang-tools-extra/clang-tidy/fuchsia/FuchsiaTidyModule.cpp (revision a966f45b7ee6a9c77a7040b51a18c01caac90918)
1 //===--- FuchsiaTidyModule.cpp - clang-tidy--------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "../ClangTidy.h"
11 #include "../ClangTidyModule.h"
12 #include "../ClangTidyModuleRegistry.h"
13 #include "DefaultArgumentsCheck.h"
14 #include "OverloadedOperatorCheck.h"
15 #include "VirtualInheritanceCheck.h"
16 
17 using namespace clang::ast_matchers;
18 
19 namespace clang {
20 namespace tidy {
21 namespace fuchsia {
22 
23 /// This module is for Fuchsia-specific checks.
24 class FuchsiaModule : public ClangTidyModule {
25 public:
26   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
27     CheckFactories.registerCheck<DefaultArgumentsCheck>(
28         "fuchsia-default-arguments");
29     CheckFactories.registerCheck<OverloadedOperatorCheck>(
30         "fuchsia-overloaded-operator");
31     CheckFactories.registerCheck<VirtualInheritanceCheck>(
32         "fuchsia-virtual-inheritance");
33   }
34 };
35 // Register the FuchsiaTidyModule using this statically initialized variable.
36 static ClangTidyModuleRegistry::Add<FuchsiaModule>
37     X("fuchsia-module", "Adds Fuchsia platform checks.");
38 } // namespace fuchsia
39 
40 // This anchor is used to force the linker to link in the generated object file
41 // and thus register the FuchsiaModule.
42 volatile int FuchsiaModuleAnchorSource = 0;
43 
44 } // namespace tidy
45 } // namespace clang
46