]> granicus.if.org Git - clang/commitdiff
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211462 91177308-0d34-0410-b5e6-96231b3b80d8

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

index c28f195b226d447f292b85709edd7aa3c586776a..8eba2f65bab46205b7ca2760b0f2b26cd15e8c3a 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 8fae207e8ead8ccd7b20a6b9bfe98d68907e96ab..c7a3e9704ac2336b3d565cd16426cceb82f59b5a 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 d6df6556122c8f2a6f0e5993e43527100ac2a16e..1d34abfd421c8537a831adf8a5bf73ccc2a2d292 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;