aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2017-10-26 08:23:20 +0000
committerHaojian Wu <hokein@google.com>2017-10-26 08:23:20 +0000
commitabcd64ccbf3357598f792f97f039d1685f42d6e7 (patch)
tree41551e56683d229552834f29c604aaf2d86516dd /clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
parent37d57dac63539e8f402db96f9053b7fa7205c8e8 (diff)
downloadllvm-abcd64ccbf3357598f792f97f039d1685f42d6e7.zip
llvm-abcd64ccbf3357598f792f97f039d1685f42d6e7.tar.gz
llvm-abcd64ccbf3357598f792f97f039d1685f42d6e7.tar.bz2
[clang-tidy ObjC] [1/3] New module `objc` for Objective-C checks
Summary: This is part 1 of 3 of a series of changes to improve Objective-C linting in clang-tidy. This introduces a new clang-tidy module, `objc`, specifically for Objective-C / Objective-C++ checks. The module is currently empty; D39142 adds the first check. Test Plan: `ninja check-clang-tools` Patch by Ben Hamilton! Reviewers: hokein, alexfh Reviewed By: hokein Subscribers: Wizard, mgorny Differential Revision: https://reviews.llvm.org/D39188 llvm-svn: 316643
Diffstat (limited to 'clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp b/clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
new file mode 100644
index 0000000..46ff21f
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
@@ -0,0 +1,39 @@
+//===--- ObjCTidyModule.cpp - clang-tidy --------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "../ClangTidy.h"
+#include "../ClangTidyModule.h"
+#include "../ClangTidyModuleRegistry.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+namespace objc {
+
+class ObjCModule : public ClangTidyModule {
+public:
+ void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
+ // TODO(D39142): Add checks here.
+ }
+};
+
+// Register the ObjCTidyModule using this statically initialized variable.
+static ClangTidyModuleRegistry::Add<ObjCModule> X(
+ "objc-module",
+ "Adds Objective-C lint checks.");
+
+} // namespace objc
+
+// This anchor is used to force the linker to link in the generated object file
+// and thus register the ObjCModule.
+volatile int ObjCModuleAnchorSource = 0;
+
+} // namespace tidy
+} // namespace clang