1 //===--- ObjCTidyModule.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 "AvoidNSErrorInitCheck.h" 13 #include "DeallocInCategoryCheck.h" 14 #include "ForbiddenSubclassingCheck.h" 15 #include "MissingHashCheck.h" 16 #include "PropertyDeclarationCheck.h" 17 #include "SuperSelfCheck.h" 18 19 using namespace clang::ast_matchers; 20 21 namespace clang { 22 namespace tidy { 23 namespace objc { 24 25 class ObjCModule : public ClangTidyModule { 26 public: 27 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { 28 CheckFactories.registerCheck<AvoidNSErrorInitCheck>( 29 "objc-avoid-nserror-init"); 30 CheckFactories.registerCheck<DeallocInCategoryCheck>( 31 "objc-dealloc-in-category"); 32 CheckFactories.registerCheck<ForbiddenSubclassingCheck>( 33 "objc-forbidden-subclassing"); 34 CheckFactories.registerCheck<MissingHashCheck>( 35 "objc-missing-hash"); 36 CheckFactories.registerCheck<PropertyDeclarationCheck>( 37 "objc-property-declaration"); 38 CheckFactories.registerCheck<SuperSelfCheck>( 39 "objc-super-self"); 40 } 41 }; 42 43 // Register the ObjCTidyModule using this statically initialized variable. 44 static ClangTidyModuleRegistry::Add<ObjCModule> X( 45 "objc-module", 46 "Adds Objective-C lint checks."); 47 48 } // namespace objc 49 50 // This anchor is used to force the linker to link in the generated object file 51 // and thus register the ObjCModule. 52 volatile int ObjCModuleAnchorSource = 0; 53 54 } // namespace tidy 55 } // namespace clang 56