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