aboutsummaryrefslogtreecommitdiff
path: root/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
commit072bce7f6ce1196355a3f906bfea8465f4fd876d (patch)
tree822d2229f8bb6c4703e7b7ce647e8daa8660b0e4 /clang-tidy/ClangTidy.h
parenta3c89b5b565bbfc1fcd69347879f4dadf36733f9 (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@199094 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-tidy/ClangTidy.h')
-rw-r--r--clang-tidy/ClangTidy.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang-tidy/ClangTidy.h b/clang-tidy/ClangTidy.h
index 16889bff..f57f8f46 100644
--- a/clang-tidy/ClangTidy.h
+++ b/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.