Add the check name to the clang-tidy diagnostic output.
Summary:
Pass check names all the way from ClangTidyModule through
ClangTidyCheck and ClangTidyContext to ClangTidyError, and output it in
handleErrors. This allows to find mis-behaving check and disable it easily.
Reviewers: djasper, klimek
Reviewed By: djasper
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2534
llvm-svn: 199094
diff --git a/clang-tools-extra/clang-tidy/ClangTidyModule.cpp b/clang-tools-extra/clang-tidy/ClangTidyModule.cpp
index dc3a11d..87ab2be 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyModule.cpp
@@ -32,8 +32,11 @@
ChecksFilter &Filter, SmallVectorImpl<ClangTidyCheck *> &Checks) {
for (FactoryMap::iterator I = Factories.begin(), E = Factories.end(); I != E;
++I) {
- if (Filter.IsCheckEnabled(I->first))
- Checks.push_back(I->second->createCheck());
+ if (Filter.IsCheckEnabled(I->first)) {
+ ClangTidyCheck *Check = I->second->createCheck();
+ Check->setName(I->first);
+ Checks.push_back(Check);
+ }
}
}