diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Basic/DiagnosticIDs.cpp | 15 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenAction.cpp | 23 | ||||
-rw-r--r-- | clang/lib/Frontend/LogDiagnosticPrinter.cpp | 1 | ||||
-rw-r--r-- | clang/lib/Frontend/PrintPreprocessedOutput.cpp | 3 | ||||
-rw-r--r-- | clang/lib/Frontend/TextDiagnostic.cpp | 4 |
5 files changed, 42 insertions, 4 deletions
diff --git a/clang/lib/Basic/DiagnosticIDs.cpp b/clang/lib/Basic/DiagnosticIDs.cpp index c8cd03e0309..cf6933aeb1c 100644 --- a/clang/lib/Basic/DiagnosticIDs.cpp +++ b/clang/lib/Basic/DiagnosticIDs.cpp @@ -30,9 +30,10 @@ namespace { // Diagnostic classes. enum { CLASS_NOTE = 0x01, - CLASS_WARNING = 0x02, - CLASS_EXTENSION = 0x03, - CLASS_ERROR = 0x04 + CLASS_REMARK = 0x02, + CLASS_WARNING = 0x03, + CLASS_EXTENSION = 0x04, + CLASS_ERROR = 0x05 }; struct StaticDiagInfoRec { @@ -409,6 +410,9 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass, case diag::MAP_IGNORE: Result = DiagnosticIDs::Ignored; break; + case diag::MAP_REMARK: + Result = DiagnosticIDs::Remark; + break; case diag::MAP_WARNING: Result = DiagnosticIDs::Warning; break; @@ -425,6 +429,11 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass, !MappingInfo.isUser()) Result = DiagnosticIDs::Warning; + // Diagnostics of class REMARK are either printed as remarks or in case they + // have been added to -Werror they are printed as errors. + if (DiagClass == CLASS_REMARK && Result == DiagnosticIDs::Warning) + Result = DiagnosticIDs::Remark; + // Ignore -pedantic diagnostics inside __extension__ blocks. // (The diagnostics controlled by -pedantic are the extension diagnostics // that are not enabled by default.) diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp index d7c03e8820a..2dab64072df 100644 --- a/clang/lib/CodeGen/CodeGenAction.cpp +++ b/clang/lib/CodeGen/CodeGenAction.cpp @@ -307,6 +307,27 @@ void BackendConsumer::InlineAsmDiagHandler2(const llvm::SMDiagnostic &D, case llvm::DS_Warning: \ DiagID = diag::warn_fe_##GroupName; \ break; \ + case llvm::DS_Remark: \ + llvm_unreachable("'remark' severity not expected"); \ + break; \ + case llvm::DS_Note: \ + DiagID = diag::note_fe_##GroupName; \ + break; \ + } \ + } while (false) + +#define ComputeDiagRemarkID(Severity, GroupName, DiagID) \ + do { \ + switch (Severity) { \ + case llvm::DS_Error: \ + DiagID = diag::err_fe_##GroupName; \ + break; \ + case llvm::DS_Warning: \ + DiagID = diag::warn_fe_##GroupName; \ + break; \ + case llvm::DS_Remark: \ + DiagID = diag::remark_fe_##GroupName; \ + break; \ case llvm::DS_Note: \ DiagID = diag::note_fe_##GroupName; \ break; \ @@ -372,7 +393,7 @@ void BackendConsumer::DiagnosticHandlerImpl(const DiagnosticInfo &DI) { break; default: // Plugin IDs are not bound to any value as they are set dynamically. - ComputeDiagID(Severity, backend_plugin, DiagID); + ComputeDiagRemarkID(Severity, backend_plugin, DiagID); break; } std::string MsgStorage; diff --git a/clang/lib/Frontend/LogDiagnosticPrinter.cpp b/clang/lib/Frontend/LogDiagnosticPrinter.cpp index 6e09a8180c9..53b13fc6f97 100644 --- a/clang/lib/Frontend/LogDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/LogDiagnosticPrinter.cpp @@ -31,6 +31,7 @@ LogDiagnosticPrinter::~LogDiagnosticPrinter() { static StringRef getLevelName(DiagnosticsEngine::Level Level) { switch (Level) { case DiagnosticsEngine::Ignored: return "ignored"; + case DiagnosticsEngine::Remark: return "remark"; case DiagnosticsEngine::Note: return "note"; case DiagnosticsEngine::Warning: return "warning"; case DiagnosticsEngine::Error: return "error"; diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index 489227d9d7e..20d7cd3a8c0 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -459,6 +459,9 @@ PragmaDiagnostic(SourceLocation Loc, StringRef Namespace, MoveToLine(Loc); OS << "#pragma " << Namespace << " diagnostic "; switch (Map) { + case diag::MAP_REMARK: + OS << "remark"; + break; case diag::MAP_WARNING: OS << "warning"; break; diff --git a/clang/lib/Frontend/TextDiagnostic.cpp b/clang/lib/Frontend/TextDiagnostic.cpp index 79f05c6ecd5..d95b925355b 100644 --- a/clang/lib/Frontend/TextDiagnostic.cpp +++ b/clang/lib/Frontend/TextDiagnostic.cpp @@ -26,6 +26,8 @@ using namespace clang; static const enum raw_ostream::Colors noteColor = raw_ostream::BLACK; +static const enum raw_ostream::Colors remarkColor = + raw_ostream::BLUE; static const enum raw_ostream::Colors fixitColor = raw_ostream::GREEN; static const enum raw_ostream::Colors caretColor = @@ -711,6 +713,7 @@ TextDiagnostic::printDiagnosticLevel(raw_ostream &OS, case DiagnosticsEngine::Ignored: llvm_unreachable("Invalid diagnostic type"); case DiagnosticsEngine::Note: OS.changeColor(noteColor, true); break; + case DiagnosticsEngine::Remark: OS.changeColor(remarkColor, true); break; case DiagnosticsEngine::Warning: OS.changeColor(warningColor, true); break; case DiagnosticsEngine::Error: OS.changeColor(errorColor, true); break; case DiagnosticsEngine::Fatal: OS.changeColor(fatalColor, true); break; @@ -721,6 +724,7 @@ TextDiagnostic::printDiagnosticLevel(raw_ostream &OS, case DiagnosticsEngine::Ignored: llvm_unreachable("Invalid diagnostic type"); case DiagnosticsEngine::Note: OS << "note"; break; + case DiagnosticsEngine::Remark: OS << "remark"; break; case DiagnosticsEngine::Warning: OS << "warning"; break; case DiagnosticsEngine::Error: OS << "error"; break; case DiagnosticsEngine::Fatal: OS << "fatal error"; break; |