Added a module for checks not related to LLVM or Google coding style.
llvm-svn: 202970
diff --git a/clang-tools-extra/clang-tidy/CMakeLists.txt b/clang-tools-extra/clang-tidy/CMakeLists.txt
index c3226dd..0354d73 100644
--- a/clang-tools-extra/clang-tidy/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -23,3 +23,4 @@
add_subdirectory(tool)
add_subdirectory(llvm)
add_subdirectory(google)
+add_subdirectory(misc)
diff --git a/clang-tools-extra/clang-tidy/Makefile b/clang-tools-extra/clang-tidy/Makefile
index c221742..80a1ddc 100644
--- a/clang-tools-extra/clang-tidy/Makefile
+++ b/clang-tools-extra/clang-tidy/Makefile
@@ -11,6 +11,6 @@
LIBRARYNAME := clangTidy
include $(CLANG_LEVEL)/../../Makefile.config
-DIRS = llvm google tool
+DIRS = llvm google misc tool
include $(CLANG_LEVEL)/Makefile
diff --git a/clang-tools-extra/clang-tidy/misc/CMakeLists.txt b/clang-tools-extra/clang-tidy/misc/CMakeLists.txt
new file mode 100644
index 0000000..5a60a35
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/misc/CMakeLists.txt
@@ -0,0 +1,11 @@
+set(LLVM_LINK_COMPONENTS support)
+
+add_clang_library(clangTidyMiscModule
+ MiscTidyModule.cpp
+
+ LINK_LIBS
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangTidy
+ )
diff --git a/clang-tools-extra/clang-tidy/misc/Makefile b/clang-tools-extra/clang-tidy/misc/Makefile
new file mode 100644
index 0000000..57e1f1a
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/misc/Makefile
@@ -0,0 +1,12 @@
+##===- clang-tidy/misc/Makefile ----------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+CLANG_LEVEL := ../../../..
+LIBRARYNAME := clangTidyMiscModule
+
+include $(CLANG_LEVEL)/Makefile
diff --git a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
new file mode 100644
index 0000000..e262dc3
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
@@ -0,0 +1,32 @@
+//===--- MiscTidyModule.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"
+
+namespace clang {
+namespace tidy {
+
+class MiscModule : public ClangTidyModule {
+public:
+ void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
+ }
+};
+
+// Register the MiscTidyModule using this statically initialized variable.
+static ClangTidyModuleRegistry::Add<MiscModule>
+X("misc-module", "Adds miscellaneous lint checks.");
+
+// This anchor is used to force the linker to link in the generated object file
+// and thus register the MiscModule.
+volatile int MiscModuleAnchorSource = 0;
+
+} // namespace tidy
+} // namespace clang
diff --git a/clang-tools-extra/clang-tidy/tool/CMakeLists.txt b/clang-tools-extra/clang-tidy/tool/CMakeLists.txt
index 72df967..a4f2085 100644
--- a/clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -11,6 +11,7 @@
clangTidy
clangTidyGoogleModule
clangTidyLLVMModule
+ clangTidyMiscModule
clangTooling
)
diff --git a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
index 68b37ca..e130d13 100644
--- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
+++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
@@ -47,11 +47,9 @@
// FIXME: Allow using --list-checks without positional arguments.
if (ListChecks) {
- std::vector<std::string> CheckNames =
- clang::tidy::getCheckNames(Checks, DisableChecks);
llvm::outs() << "Enabled checks:";
- for (unsigned i = 0; i < CheckNames.size(); ++i)
- llvm::outs() << "\n " << CheckNames[i];
+ for (auto CheckName : clang::tidy::getCheckNames(Checks, DisableChecks))
+ llvm::outs() << "\n " << CheckName;
llvm::outs() << "\n\n";
return 0;
}
@@ -76,5 +74,9 @@
extern volatile int GoogleModuleAnchorSource;
static int GoogleModuleAnchorDestination = GoogleModuleAnchorSource;
+// This anchor is used to force the linker to link the MiscModule.
+extern volatile int MiscModuleAnchorSource;
+static int MiscModuleAnchorDestination = MiscModuleAnchorSource;
+
} // namespace tidy
} // namespace clang
diff --git a/clang-tools-extra/clang-tidy/tool/Makefile b/clang-tools-extra/clang-tidy/tool/Makefile
index 203fcdb..c63e23f 100644
--- a/clang-tools-extra/clang-tidy/tool/Makefile
+++ b/clang-tools-extra/clang-tidy/tool/Makefile
@@ -17,6 +17,7 @@
include $(CLANG_LEVEL)/../../Makefile.config
LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option
USEDLIBS = clangTidy.a clangTidyLLVMModule.a clangTidyGoogleModule.a \
+ clangTidyMiscModule.a \
clangStaticAnalyzerFrontend.a clangStaticAnalyzerCheckers.a \
clangStaticAnalyzerCore.a \
clangFormat.a clangASTMatchers.a clangTooling.a clangFrontend.a \