diff options
author | Alexander Kornienko <alexfh@google.com> | 2014-01-13 10:50:51 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2014-01-13 10:50:51 +0000 |
commit | 41bfe8dde13b629a13e95e3b5f31ba1efca993ac (patch) | |
tree | 990256f3b3f48af40186071435c66a36f96e5062 /clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp | |
parent | 7fdd4857f7367c1e17ace045c195f2c85e2186ba (diff) | |
download | bcm5719-llvm-41bfe8dde13b629a13e95e3b5f31ba1efca993ac.tar.gz bcm5719-llvm-41bfe8dde13b629a13e95e3b5f31ba1efca993ac.zip |
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
Diffstat (limited to 'clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp b/clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp index ec1e779a8e8..137bb6c41ce 100644 --- a/clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp @@ -40,14 +40,14 @@ void NamespaceCommentCheck::check(const MatchFinder::MatchResult &Result) { // FIXME: Check that this namespace is "long". if (Tok.is(tok::comment)) { // FIXME: Check comment content. + // FIXME: Check comment placement on the same line. return; } std::string Fix = " // namespace"; if (!ND->isAnonymousNamespace()) Fix = Fix.append(" ").append(ND->getNameAsString()); - Context->Diag(ND->getLocation(), - "namespace not terminated with a closing comment") + diag(ND->getLocation(), "namespace not terminated with a closing comment") << FixItHint::CreateInsertion(ND->getRBraceLoc().getLocWithOffset(1), Fix); } @@ -55,8 +55,8 @@ void NamespaceCommentCheck::check(const MatchFinder::MatchResult &Result) { namespace { class IncludeOrderPPCallbacks : public PPCallbacks { public: - explicit IncludeOrderPPCallbacks(ClangTidyContext &Context) - : Context(Context) {} + explicit IncludeOrderPPCallbacks(IncludeOrderCheck &Check) + : Check(Check) {} virtual void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, @@ -66,17 +66,17 @@ public: const Module *Imported) { // FIXME: This is a dummy implementation to show how to get at preprocessor // information. Implement a real include order check. - Context.Diag(HashLoc, "This is an include"); + Check.diag(HashLoc, "This is an include"); } private: - ClangTidyContext &Context; + IncludeOrderCheck &Check; }; } // namespace void IncludeOrderCheck::registerPPCallbacks(CompilerInstance &Compiler) { Compiler.getPreprocessor() - .addPPCallbacks(new IncludeOrderPPCallbacks(*Context)); + .addPPCallbacks(new IncludeOrderPPCallbacks(*this)); } class LLVMModule : public ClangTidyModule { |