clang-tools 6.0.0

ObjCTidyModule.cpp
Go to the documentation of this file.
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
clang::ast_matchers
Definition: ClangTidyDiagnosticConsumer.h:27
clang::tidy::objc::PropertyDeclarationCheck
Definition: PropertyDeclarationCheck.h:29
clang::tidy::objc::ForbiddenSubclassingCheck
Finds Objective-C classes which have a superclass which is documented to not support subclassing...
Definition: ForbiddenSubclassingCheck.h:27
clang::tidy::ClangTidyCheckFactories::registerCheck
void registerCheck(StringRef CheckName)
Registers the CheckType with the name Name.
Definition: ClangTidyModule.h:59
clang::tidy::objc::ObjCModule
Definition: ObjCTidyModule.cpp:24
clang::tidy::ClangTidyCheckFactories
A collection of ClangTidyCheckFactory instances.
Definition: ClangTidyModule.h:27
clang::tidy::objc::AvoidSpinlockCheck
Finds usages of OSSpinlock, which is deprecated due to potential livelock problems.
Definition: AvoidSpinlockCheck.h:24
clang::tidy::ClangTidyModule
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Definition: ClangTidyModule.h:84
AvoidSpinlockCheck.h
clang::tidy::objc::AvoidNSErrorInitCheck
Finds usages of [NSSError init].
Definition: AvoidNSErrorInitCheck.h:24
clang::tidy::ObjCModuleAnchorSource
volatile int ObjCModuleAnchorSource
Definition: ObjCTidyModule.cpp:47
X
static clang::FrontendPluginRegistry::Add< clang::tidy::ClangTidyPluginAction > X("clang-tidy", "clang-tidy")
clang
Definition: AndroidTidyModule.cpp:28
AvoidNSErrorInitCheck.h
clang::tidy::objc::ObjCModule::addCheckFactories
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module...
Definition: ObjCTidyModule.cpp:26
ForbiddenSubclassingCheck.h
PropertyDeclarationCheck.h