summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2014-03-05 13:14:32 +0000
committerAlexander Kornienko <alexfh@google.com>2014-03-05 13:14:32 +0000
commit16ac6cebcfb58ef80cb708cca2ce5994cf64abdb (patch)
treec34ee03b5f2119c45514415b4c9d272dbe0bfcfa
parent21f3b77707c5b4a273746095e078671ec08d2ab6 (diff)
downloadbcm5719-llvm-16ac6cebcfb58ef80cb708cca2ce5994cf64abdb.tar.gz
bcm5719-llvm-16ac6cebcfb58ef80cb708cca2ce5994cf64abdb.zip
Added a module for checks not related to LLVM or Google coding style.
llvm-svn: 202970
-rw-r--r--clang-tools-extra/clang-tidy/CMakeLists.txt1
-rw-r--r--clang-tools-extra/clang-tidy/Makefile2
-rw-r--r--clang-tools-extra/clang-tidy/misc/CMakeLists.txt11
-rw-r--r--clang-tools-extra/clang-tidy/misc/Makefile12
-rw-r--r--clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp32
-rw-r--r--clang-tools-extra/clang-tidy/tool/CMakeLists.txt1
-rw-r--r--clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp10
-rw-r--r--clang-tools-extra/clang-tidy/tool/Makefile1
8 files changed, 65 insertions, 5 deletions
diff --git a/clang-tools-extra/clang-tidy/CMakeLists.txt b/clang-tools-extra/clang-tidy/CMakeLists.txt
index c3226dd8d69..0354d73485e 100644
--- a/clang-tools-extra/clang-tidy/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -23,3 +23,4 @@ add_clang_library(clangTidy
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 c221742c420..80a1ddcfbda 100644
--- a/clang-tools-extra/clang-tidy/Makefile
+++ b/clang-tools-extra/clang-tidy/Makefile
@@ -11,6 +11,6 @@ CLANG_LEVEL := ../../..
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 00000000000..5a60a35dd6d
--- /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 00000000000..57e1f1a3eda
--- /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 00000000000..e262dc356d0
--- /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 72df967d258..a4f20854f7f 100644
--- a/clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -11,6 +11,7 @@ target_link_libraries(clang-tidy
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 68b37ca74db..e130d13930d 100644
--- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
+++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
@@ -47,11 +47,9 @@ int main(int argc, const char **argv) {
// 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 @@ static int LLVMModuleAnchorDestination = LLVMModuleAnchorSource;
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 203fcdbf334..c63e23f850c 100644
--- a/clang-tools-extra/clang-tidy/tool/Makefile
+++ b/clang-tools-extra/clang-tidy/tool/Makefile
@@ -17,6 +17,7 @@ TOOL_NO_EXPORTS = 1
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 \
OpenPOWER on IntegriCloud