clang-tools  7.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"
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");
32  "objc-forbidden-subclassing");
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
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.
A collection of ClangTidyCheckFactory instances.
Finds usages of OSSpinlock, which is deprecated due to potential livelock problems.
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Finds usages of [NSSError 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...