1 //===--- FuchsiaTidyModule.cpp - clang-tidy -------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "../ClangTidy.h"
10 #include "../ClangTidyModule.h"
11 #include "../ClangTidyModuleRegistry.h"
12 #include "../google/UnnamedNamespaceInHeaderCheck.h"
13 #include "DefaultArgumentsCallsCheck.h"
14 #include "DefaultArgumentsDeclarationsCheck.h"
15 #include "MultipleInheritanceCheck.h"
16 #include "OverloadedOperatorCheck.h"
17 #include "StaticallyConstructedObjectsCheck.h"
18 #include "TrailingReturnCheck.h"
19 #include "VirtualInheritanceCheck.h"
21 using namespace clang::ast_matchers
;
27 /// This module is for Fuchsia-specific checks.
28 class FuchsiaModule
: public ClangTidyModule
{
30 void addCheckFactories(ClangTidyCheckFactories
&CheckFactories
) override
{
31 CheckFactories
.registerCheck
<DefaultArgumentsCallsCheck
>(
32 "fuchsia-default-arguments-calls");
33 CheckFactories
.registerCheck
<DefaultArgumentsDeclarationsCheck
>(
34 "fuchsia-default-arguments-declarations");
35 CheckFactories
.registerCheck
<google::build::UnnamedNamespaceInHeaderCheck
>(
36 "fuchsia-header-anon-namespaces");
37 CheckFactories
.registerCheck
<MultipleInheritanceCheck
>(
38 "fuchsia-multiple-inheritance");
39 CheckFactories
.registerCheck
<OverloadedOperatorCheck
>(
40 "fuchsia-overloaded-operator");
41 CheckFactories
.registerCheck
<StaticallyConstructedObjectsCheck
>(
42 "fuchsia-statically-constructed-objects");
43 CheckFactories
.registerCheck
<TrailingReturnCheck
>(
44 "fuchsia-trailing-return");
45 CheckFactories
.registerCheck
<VirtualInheritanceCheck
>(
46 "fuchsia-virtual-inheritance");
49 // Register the FuchsiaTidyModule using this statically initialized variable.
50 static ClangTidyModuleRegistry::Add
<FuchsiaModule
>
51 X("fuchsia-module", "Adds Fuchsia platform checks.");
52 } // namespace fuchsia
54 // This anchor is used to force the linker to link in the generated object file
55 // and thus register the FuchsiaModule.
56 volatile int FuchsiaModuleAnchorSource
= 0;