1 //===--- ObjCTidyModule.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"
13 #include "AvoidNSErrorInitCheck.h"
14 #include "AvoidSpinlockCheck.h"
15 #include "ForbiddenSubclassingCheck.h"
16 #include "PropertyDeclarationCheck.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<AvoidSpinlockCheck>(
30         "objc-avoid-spinlock");
31     CheckFactories.registerCheck<ForbiddenSubclassingCheck>(
32         "objc-forbidden-subclassing");
33     CheckFactories.registerCheck<PropertyDeclarationCheck>(
34         "objc-property-declaration");
35   }
36 };
37 
38 // Register the ObjCTidyModule using this statically initialized variable.
39 static ClangTidyModuleRegistry::Add<ObjCModule> X(
40     "objc-module",
41     "Adds Objective-C lint checks.");
42 
43 } // namespace objc
44 
45 // This anchor is used to force the linker to link in the generated object file
46 // and thus register the ObjCModule.
47 volatile int ObjCModuleAnchorSource = 0;
48 
49 } // namespace tidy
50 } // namespace clang
51