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