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 { 24 namespace tidy { 25 namespace fuchsia { 26 27 /// This module is for Fuchsia-specific checks. 28 class FuchsiaModule : public ClangTidyModule { 29 public: addCheckFactories(ClangTidyCheckFactories & CheckFactories)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"); 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 60