[clang-tools-extra] r202668 - Add a level parameter to ClangTidyCheck::diag.

Peter Collingbourne peter at pcc.me.uk
Sun Mar 2 15:34:49 PST 2014


Author: pcc
Date: Sun Mar  2 17:34:48 2014
New Revision: 202668

URL: http://llvm.org/viewvc/llvm-project?rev=202668&view=rev
Log:
Add a level parameter to ClangTidyCheck::diag.

The goal is to make it possible for checks to emit diagnostics at levels
other than 'warning'.

Differential Revision: http://llvm-reviews.chandlerc.com/D2913

Modified:
    clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
    clang-tools-extra/trunk/clang-tidy/ClangTidy.h

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=202668&r1=202667&r2=202668&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Sun Mar  2 17:34:48 2014
@@ -226,8 +226,9 @@ bool ChecksFilter::IsCheckEnabled(String
   return EnableChecks.match(Name) && !DisableChecks.match(Name);
 }
 
-DiagnosticBuilder ClangTidyCheck::diag(SourceLocation Loc, StringRef Message) {
-  return Context->diag(CheckName, Loc, Message);
+DiagnosticBuilder ClangTidyCheck::diag(SourceLocation Loc, StringRef Message,
+                                       DiagnosticIDs::Level Level) {
+  return Context->diag(CheckName, Loc, Message, Level);
 }
 
 void ClangTidyCheck::run(const ast_matchers::MatchFinder::MatchResult &Result) {

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.h?rev=202668&r1=202667&r2=202668&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.h Sun Mar  2 17:34:48 2014
@@ -76,7 +76,8 @@ public:
   void setContext(ClangTidyContext *Ctx) { Context = Ctx; }
 
   /// \brief Add a diagnostic with the check's name.
-  DiagnosticBuilder diag(SourceLocation Loc, StringRef Description);
+  DiagnosticBuilder diag(SourceLocation Loc, StringRef Description,
+                         DiagnosticIDs::Level Level = DiagnosticIDs::Warning);
 
   /// \brief Sets the check name. Intended to be used by the clang-tidy
   /// framework. Can be called only once.





More information about the cfe-commits mailing list