| 1 | //===--- FuchsiaTidyModule.cpp - clang-tidy -------------------------------===// |
|---|---|
| 2 | // |
| 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 |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 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" |
| 20 | |
| 21 | using namespace clang::ast_matchers; |
| 22 | |
| 23 | namespace clang::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<DefaultArgumentsCallsCheck>( |
| 31 | CheckName: "fuchsia-default-arguments-calls"); |
| 32 | CheckFactories.registerCheck<DefaultArgumentsDeclarationsCheck>( |
| 33 | CheckName: "fuchsia-default-arguments-declarations"); |
| 34 | CheckFactories.registerCheck<google::build::UnnamedNamespaceInHeaderCheck>( |
| 35 | CheckName: "fuchsia-header-anon-namespaces"); |
| 36 | CheckFactories.registerCheck<MultipleInheritanceCheck>( |
| 37 | CheckName: "fuchsia-multiple-inheritance"); |
| 38 | CheckFactories.registerCheck<OverloadedOperatorCheck>( |
| 39 | CheckName: "fuchsia-overloaded-operator"); |
| 40 | CheckFactories.registerCheck<StaticallyConstructedObjectsCheck>( |
| 41 | CheckName: "fuchsia-statically-constructed-objects"); |
| 42 | CheckFactories.registerCheck<TrailingReturnCheck>( |
| 43 | CheckName: "fuchsia-trailing-return"); |
| 44 | CheckFactories.registerCheck<VirtualInheritanceCheck>( |
| 45 | CheckName: "fuchsia-virtual-inheritance"); |
| 46 | } |
| 47 | }; |
| 48 | // Register the FuchsiaTidyModule using this statically initialized variable. |
| 49 | static ClangTidyModuleRegistry::Add<FuchsiaModule> |
| 50 | X("fuchsia-module", "Adds Fuchsia platform checks."); |
| 51 | } // namespace fuchsia |
| 52 | |
| 53 | // This anchor is used to force the linker to link in the generated object file |
| 54 | // and thus register the FuchsiaModule. |
| 55 | volatile int FuchsiaModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage) |
| 56 | |
| 57 | } // namespace clang::tidy |
| 58 |
