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