r211462 - TextDiagnosticPrinter: use the mapped level for remark flag computation

Alp Toker alp at nuanti.com
Sun Jun 22 03:08:07 PDT 2014


Author: alp
Date: Sun Jun 22 05:08:06 2014
New Revision: 211462

URL: http://llvm.org/viewvc/llvm-project?rev=211462&view=rev
Log:
TextDiagnosticPrinter: use the mapped level for remark flag computation

Custom diagnostics don't have a builtin class so this wouldn't have worked.
Reduces surface area of remark-related changes.

No test coverage.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticIDs.h
    cfe/trunk/lib/Basic/DiagnosticIDs.cpp
    cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticIDs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticIDs.h?rev=211462&r1=211461&r2=211462&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticIDs.h (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticIDs.h Sun Jun 22 05:08:06 2014
@@ -148,9 +148,6 @@ public:
   /// default.
   static bool isDefaultMappingAsError(unsigned DiagID);
 
-  /// \brief Return true if the specified diagnostic is a Remark.
-  static bool isRemark(unsigned DiagID);
-
   /// \brief Determine whether the given built-in diagnostic ID is a Note.
   static bool isBuiltinNote(unsigned DiagID);
 

Modified: cfe/trunk/lib/Basic/DiagnosticIDs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=211462&r1=211461&r2=211462&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/DiagnosticIDs.cpp (original)
+++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp Sun Jun 22 05:08:06 2014
@@ -353,11 +353,6 @@ bool DiagnosticIDs::isDefaultMappingAsEr
   return GetDefaultDiagMapping(DiagID).getSeverity() == diag::Severity::Error;
 }
 
-bool DiagnosticIDs::isRemark(unsigned DiagID) {
-  return DiagID < diag::DIAG_UPPER_LIMIT &&
-         getBuiltinDiagClass(DiagID) == CLASS_REMARK;
-}
-
 /// getDescription - Given a diagnostic ID, return a description of the
 /// issue.
 StringRef DiagnosticIDs::getDescription(unsigned DiagID) const {

Modified: cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp?rev=211462&r1=211461&r2=211462&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp Sun Jun 22 05:08:06 2014
@@ -82,7 +82,7 @@ static void printDiagnosticOptions(raw_o
     StringRef Opt = DiagnosticIDs::getWarningOptionForDiag(Info.getID());
     if (!Opt.empty()) {
       OS << (Started ? "," : " [")
-         << (DiagnosticIDs::isRemark(Info.getID()) ? "-R" : "-W") << Opt;
+         << (Level == DiagnosticsEngine::Remark ? "-R" : "-W") << Opt;
       StringRef OptValue = Info.getDiags()->getFlagNameValue();
       if (!OptValue.empty())
         OS << "=" << OptValue;





More information about the cfe-commits mailing list