clang-tools  10.0.0
ObjCTidyModule.cpp
Go to the documentation of this file.
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"
14 #include "MissingHashCheck.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");
30  "objc-forbidden-subclassing");
31  CheckFactories.registerCheck<MissingHashCheck>(
32  "objc-missing-hash");
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
Finds Objective-C classes which have a superclass which is documented to not support subclassing...
static ClangTidyModuleRegistry::Add< ObjCModule > X("objc-module", "Adds Objective-C lint checks.")
void registerCheck(StringRef CheckName)
Registers the CheckType with the name Name.
Finds Objective-C implementations that implement -isEqual: without also appropriately implementing -h...
A collection of ClangTidyCheckFactory instances.
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Finds invocations of -self on super instances in initializers of subclasses of NSObject and recommend...
Finds usages of -[NSError init].
volatile int ObjCModuleAnchorSource
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module...