TextDiagnosticPrinter: use the mapped level for remark flag computation
authorAlp Toker <alp@nuanti.com>
Sun, 22 Jun 2014 10:08:06 +0000 (10:08 +0000)
committerAlp Toker <alp@nuanti.com>
Sun, 22 Jun 2014 10:08:06 +0000 (10:08 +0000)
Custom diagnostics don't have a builtin class so this wouldn't have worked.
Reduces surface area of remark-related changes.

No test coverage.

llvm-svn: 211462

clang/include/clang/Basic/DiagnosticIDs.h
clang/lib/Basic/DiagnosticIDs.cpp
clang/lib/Frontend/TextDiagnosticPrinter.cpp

index c28f195..8eba2f6 100644 (file)
@@ -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);
 
index 8fae207..c7a3e97 100644 (file)
@@ -353,11 +353,6 @@ bool DiagnosticIDs::isDefaultMappingAsError(unsigned DiagID) {
   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 {
index d6df655..1d34abf 100644 (file)
@@ -82,7 +82,7 @@ static void printDiagnosticOptions(raw_ostream &OS,
     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;