clang-tools 22.0.0git
ObjCTidyModule.cpp
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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"
12#include "AssertEquals.h"
16#include "MissingHashCheck.h"
20#include "SuperSelfCheck.h"
21
22using namespace clang::ast_matchers;
23
24namespace clang::tidy {
25namespace objc {
26
28public:
29 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
31 "objc-avoid-nserror-init");
32 CheckFactories.registerCheck<AssertEquals>("objc-assert-equals");
33
35 "objc-dealloc-in-category");
37 "objc-forbidden-subclassing");
38 CheckFactories.registerCheck<MissingHashCheck>("objc-missing-hash");
39 CheckFactories.registerCheck<NSDateFormatterCheck>("objc-nsdate-formatter");
41 "objc-nsinvocation-argument-lifetime");
43 "objc-property-declaration");
44 CheckFactories.registerCheck<SuperSelfCheck>("objc-super-self");
45 }
46};
47
48// Register the ObjCTidyModule using this statically initialized variable.
49static ClangTidyModuleRegistry::Add<ObjCModule>
50 X("objc-module", "Adds Objective-C lint checks.");
51
52} // namespace objc
53
54// This anchor is used to force the linker to link in the generated object file
55// and thus register the ObjCModule.
56volatile int ObjCModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
57
58} // namespace clang::tidy
A collection of ClangTidyCheckFactory instances.
void registerCheck(llvm::StringRef CheckName)
Registers the CheckType with the name Name.
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Warn if XCTAssertEqual() or XCTAssertNotEqual() is used with at least one operands of type NSString*.
Finds implementations of -dealloc in Objective-C categories.
Finds Objective-C classes which have a superclass which is documented to not support subclassing.
Finds Objective-C implementations that implement -isEqual: without also appropriately implementing -h...
Checks the string pattern used as a date format specifier and reports warnings if it contains any inc...
Finds calls to NSInvocation methods under ARC that don't have proper argument object lifetimes.
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module.
Finds invocations of -self on super instances in initializers of subclasses of NSObject and recommend...
static ClangTidyModuleRegistry::Add< ObjCModule > X("objc-module", "Adds Objective-C lint checks.")
volatile int ObjCModuleAnchorSource