summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/ClangTidy.h
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2014-01-13 10:50:51 +0000
committerAlexander Kornienko <alexfh@google.com>2014-01-13 10:50:51 +0000
commit41bfe8dde13b629a13e95e3b5f31ba1efca993ac (patch)
tree990256f3b3f48af40186071435c66a36f96e5062 /clang-tools-extra/clang-tidy/ClangTidy.h
parent7fdd4857f7367c1e17ace045c195f2c85e2186ba (diff)
downloadbcm5719-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/ClangTidy.h')
-rw-r--r--clang-tools-extra/clang-tidy/ClangTidy.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-tidy/ClangTidy.h b/clang-tools-extra/clang-tidy/ClangTidy.h
index 16889bff80a..f57f8f464c2 100644
--- a/clang-tools-extra/clang-tidy/ClangTidy.h
+++ b/clang-tools-extra/clang-tidy/ClangTidy.h
@@ -75,11 +75,17 @@ public:
/// \brief The infrastructure sets the context to \p Ctx with this function.
void setContext(ClangTidyContext *Ctx) { Context = Ctx; }
-protected:
- ClangTidyContext *Context;
+ /// \brief Add a diagnostic with the check's name.
+ DiagnosticBuilder diag(SourceLocation Loc, StringRef Message);
+
+ /// \brief Sets the check name. Intended to be used by the clang-tidy
+ /// framework. Can be called only once.
+ void setName(StringRef Name);
private:
virtual void run(const ast_matchers::MatchFinder::MatchResult &Result);
+ ClangTidyContext *Context;
+ std::string CheckName;
};
/// \brief Filters checks by name.
OpenPOWER on IntegriCloud