Aaron Ballman | d3d78b9 | 2017-11-28 21:09:25 +0000 | [diff] [blame] | 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" |
Julie Hockett | 8c1ee67 | 2018-04-10 16:53:51 +0000 | [diff] [blame] | 13 | #include "../google/UnnamedNamespaceInHeaderCheck.h" |
Aaron Ballman | d3d78b9 | 2017-11-28 21:09:25 +0000 | [diff] [blame] | 14 | #include "DefaultArgumentsCheck.h" |
Julie Hockett | 587deb4 | 2018-01-19 23:59:59 +0000 | [diff] [blame] | 15 | #include "MultipleInheritanceCheck.h" |
Julie Hockett | a966f45 | 2017-12-22 16:52:25 +0000 | [diff] [blame] | 16 | #include "OverloadedOperatorCheck.h" |
Julie Hockett | f108a8f | 2018-05-11 21:08:59 +0000 | [diff] [blame^] | 17 | #include "RestrictSystemIncludesCheck.h" |
Julie Hockett | 1ee1f49 | 2018-01-11 21:17:43 +0000 | [diff] [blame] | 18 | #include "StaticallyConstructedObjectsCheck.h" |
Julie Hockett | 93a88e3 | 2018-01-17 21:18:15 +0000 | [diff] [blame] | 19 | #include "TrailingReturnCheck.h" |
Julie Hockett | 63b57db | 2017-12-15 18:54:28 +0000 | [diff] [blame] | 20 | #include "VirtualInheritanceCheck.h" |
Aaron Ballman | d3d78b9 | 2017-11-28 21:09:25 +0000 | [diff] [blame] | 21 | |
| 22 | using namespace clang::ast_matchers; |
| 23 | |
| 24 | namespace clang { |
| 25 | namespace tidy { |
| 26 | namespace fuchsia { |
| 27 | |
Julie Hockett | a0d50ce | 2017-12-05 18:50:49 +0000 | [diff] [blame] | 28 | /// This module is for Fuchsia-specific checks. |
Aaron Ballman | d3d78b9 | 2017-11-28 21:09:25 +0000 | [diff] [blame] | 29 | class FuchsiaModule : public ClangTidyModule { |
| 30 | public: |
| 31 | void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { |
| 32 | CheckFactories.registerCheck<DefaultArgumentsCheck>( |
| 33 | "fuchsia-default-arguments"); |
Julie Hockett | 8c1ee67 | 2018-04-10 16:53:51 +0000 | [diff] [blame] | 34 | CheckFactories.registerCheck<google::build::UnnamedNamespaceInHeaderCheck>( |
| 35 | "fuchsia-header-anon-namespaces"); |
Julie Hockett | 587deb4 | 2018-01-19 23:59:59 +0000 | [diff] [blame] | 36 | CheckFactories.registerCheck<MultipleInheritanceCheck>( |
| 37 | "fuchsia-multiple-inheritance"); |
Julie Hockett | a966f45 | 2017-12-22 16:52:25 +0000 | [diff] [blame] | 38 | CheckFactories.registerCheck<OverloadedOperatorCheck>( |
| 39 | "fuchsia-overloaded-operator"); |
Julie Hockett | f108a8f | 2018-05-11 21:08:59 +0000 | [diff] [blame^] | 40 | CheckFactories.registerCheck<RestrictSystemIncludesCheck>( |
| 41 | "fuchsia-restrict-system-includes"); |
Julie Hockett | 1ee1f49 | 2018-01-11 21:17:43 +0000 | [diff] [blame] | 42 | CheckFactories.registerCheck<StaticallyConstructedObjectsCheck>( |
| 43 | "fuchsia-statically-constructed-objects"); |
Julie Hockett | 93a88e3 | 2018-01-17 21:18:15 +0000 | [diff] [blame] | 44 | CheckFactories.registerCheck<TrailingReturnCheck>( |
| 45 | "fuchsia-trailing-return"); |
Julie Hockett | 63b57db | 2017-12-15 18:54:28 +0000 | [diff] [blame] | 46 | CheckFactories.registerCheck<VirtualInheritanceCheck>( |
| 47 | "fuchsia-virtual-inheritance"); |
Aaron Ballman | d3d78b9 | 2017-11-28 21:09:25 +0000 | [diff] [blame] | 48 | } |
| 49 | }; |
| 50 | // Register the FuchsiaTidyModule using this statically initialized variable. |
| 51 | static ClangTidyModuleRegistry::Add<FuchsiaModule> |
| 52 | X("fuchsia-module", "Adds Fuchsia platform checks."); |
| 53 | } // namespace fuchsia |
| 54 | |
| 55 | // This anchor is used to force the linker to link in the generated object file |
| 56 | // and thus register the FuchsiaModule. |
| 57 | volatile int FuchsiaModuleAnchorSource = 0; |
| 58 | |
| 59 | } // namespace tidy |
| 60 | } // namespace clang |