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 "MultipleInheritanceCheck.h"
15 #include "OverloadedOperatorCheck.h"
16 #include "StaticallyConstructedObjectsCheck.h"
17 #include "TrailingReturnCheck.h"
18 #include "VirtualInheritanceCheck.h"
19 
20 using namespace clang::ast_matchers;
21 
22 namespace clang {
23 namespace tidy {
24 namespace fuchsia {
25 
26 /// This module is for Fuchsia-specific checks.
27 class FuchsiaModule : public ClangTidyModule {
28 public:
29   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
30     CheckFactories.registerCheck<DefaultArgumentsCheck>(
31         "fuchsia-default-arguments");
32     CheckFactories.registerCheck<MultipleInheritanceCheck>(
33         "fuchsia-multiple-inheritance");
34     CheckFactories.registerCheck<OverloadedOperatorCheck>(
35         "fuchsia-overloaded-operator");
36     CheckFactories.registerCheck<StaticallyConstructedObjectsCheck>(
37         "fuchsia-statically-constructed-objects");
38     CheckFactories.registerCheck<TrailingReturnCheck>(
39         "fuchsia-trailing-return");
40     CheckFactories.registerCheck<VirtualInheritanceCheck>(
41         "fuchsia-virtual-inheritance");
42   }
43 };
44 // Register the FuchsiaTidyModule using this statically initialized variable.
45 static ClangTidyModuleRegistry::Add<FuchsiaModule>
46     X("fuchsia-module", "Adds Fuchsia platform checks.");
47 } // namespace fuchsia
48 
49 // This anchor is used to force the linker to link in the generated object file
50 // and thus register the FuchsiaModule.
51 volatile int FuchsiaModuleAnchorSource = 0;
52 
53 } // namespace tidy
54 } // namespace clang
55