Aaron Ballman | d3d78b9 | 2017-11-28 21:09:25 +0000 | [diff] [blame] | 1 | //===--- FuchsiaTidyModule.cpp - clang-tidy--------------------------------===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Aaron Ballman | d3d78b9 | 2017-11-28 21:09:25 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "../ClangTidy.h" |
| 10 | #include "../ClangTidyModule.h" |
| 11 | #include "../ClangTidyModuleRegistry.h" |
Julie Hockett | 8c1ee67 | 2018-04-10 16:53:51 +0000 | [diff] [blame] | 12 | #include "../google/UnnamedNamespaceInHeaderCheck.h" |
Aaron Ballman | d3d78b9 | 2017-11-28 21:09:25 +0000 | [diff] [blame] | 13 | #include "DefaultArgumentsCheck.h" |
Julie Hockett | 587deb4 | 2018-01-19 23:59:59 +0000 | [diff] [blame] | 14 | #include "MultipleInheritanceCheck.h" |
Julie Hockett | a966f45 | 2017-12-22 16:52:25 +0000 | [diff] [blame] | 15 | #include "OverloadedOperatorCheck.h" |
Julie Hockett | f108a8f | 2018-05-11 21:08:59 +0000 | [diff] [blame] | 16 | #include "RestrictSystemIncludesCheck.h" |
Julie Hockett | 1ee1f49 | 2018-01-11 21:17:43 +0000 | [diff] [blame] | 17 | #include "StaticallyConstructedObjectsCheck.h" |
Julie Hockett | 93a88e3 | 2018-01-17 21:18:15 +0000 | [diff] [blame] | 18 | #include "TrailingReturnCheck.h" |
Julie Hockett | 63b57db | 2017-12-15 18:54:28 +0000 | [diff] [blame] | 19 | #include "VirtualInheritanceCheck.h" |
Aaron Ballman | d3d78b9 | 2017-11-28 21:09:25 +0000 | [diff] [blame] | 20 | |
| 21 | using namespace clang::ast_matchers; |
| 22 | |
| 23 | namespace clang { |
| 24 | namespace tidy { |
| 25 | namespace fuchsia { |
| 26 | |
Julie Hockett | a0d50ce | 2017-12-05 18:50:49 +0000 | [diff] [blame] | 27 | /// This module is for Fuchsia-specific checks. |
Aaron Ballman | d3d78b9 | 2017-11-28 21:09:25 +0000 | [diff] [blame] | 28 | class FuchsiaModule : public ClangTidyModule { |
| 29 | public: |
| 30 | void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { |
| 31 | CheckFactories.registerCheck<DefaultArgumentsCheck>( |
| 32 | "fuchsia-default-arguments"); |
Julie Hockett | 8c1ee67 | 2018-04-10 16:53:51 +0000 | [diff] [blame] | 33 | CheckFactories.registerCheck<google::build::UnnamedNamespaceInHeaderCheck>( |
| 34 | "fuchsia-header-anon-namespaces"); |
Julie Hockett | 587deb4 | 2018-01-19 23:59:59 +0000 | [diff] [blame] | 35 | CheckFactories.registerCheck<MultipleInheritanceCheck>( |
| 36 | "fuchsia-multiple-inheritance"); |
Julie Hockett | a966f45 | 2017-12-22 16:52:25 +0000 | [diff] [blame] | 37 | CheckFactories.registerCheck<OverloadedOperatorCheck>( |
| 38 | "fuchsia-overloaded-operator"); |
Julie Hockett | f108a8f | 2018-05-11 21:08:59 +0000 | [diff] [blame] | 39 | CheckFactories.registerCheck<RestrictSystemIncludesCheck>( |
| 40 | "fuchsia-restrict-system-includes"); |
Julie Hockett | 1ee1f49 | 2018-01-11 21:17:43 +0000 | [diff] [blame] | 41 | CheckFactories.registerCheck<StaticallyConstructedObjectsCheck>( |
| 42 | "fuchsia-statically-constructed-objects"); |
Julie Hockett | 93a88e3 | 2018-01-17 21:18:15 +0000 | [diff] [blame] | 43 | CheckFactories.registerCheck<TrailingReturnCheck>( |
| 44 | "fuchsia-trailing-return"); |
Julie Hockett | 63b57db | 2017-12-15 18:54:28 +0000 | [diff] [blame] | 45 | CheckFactories.registerCheck<VirtualInheritanceCheck>( |
| 46 | "fuchsia-virtual-inheritance"); |
Aaron Ballman | d3d78b9 | 2017-11-28 21:09:25 +0000 | [diff] [blame] | 47 | } |
| 48 | }; |
| 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 |
| 53 | |
| 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; |
| 57 | |
| 58 | } // namespace tidy |
| 59 | } // namespace clang |