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