From 2724ec37f312377e65c48d9b758e5c59df2c27a9 Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Sun, 22 Jun 2014 10:08:06 +0000 Subject: [PATCH] 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. llvm-svn: 211462 --- clang/include/clang/Basic/DiagnosticIDs.h | 3 --- clang/lib/Basic/DiagnosticIDs.cpp | 5 ----- clang/lib/Frontend/TextDiagnosticPrinter.cpp | 2 +- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticIDs.h b/clang/include/clang/Basic/DiagnosticIDs.h index c28f195b226d..8eba2f65bab4 100644 --- a/clang/include/clang/Basic/DiagnosticIDs.h +++ b/clang/include/clang/Basic/DiagnosticIDs.h @@ -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); diff --git a/clang/lib/Basic/DiagnosticIDs.cpp b/clang/lib/Basic/DiagnosticIDs.cpp index 8fae207e8ead..c7a3e9704ac2 100644 --- a/clang/lib/Basic/DiagnosticIDs.cpp +++ b/clang/lib/Basic/DiagnosticIDs.cpp @@ -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 { diff --git a/clang/lib/Frontend/TextDiagnosticPrinter.cpp b/clang/lib/Frontend/TextDiagnosticPrinter.cpp index d6df6556122c..1d34abfd421c 100644 --- a/clang/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/TextDiagnosticPrinter.cpp @@ -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;