From 741602461d2079c682916bce6701c39acb08bbd3 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Fri, 28 Feb 2014 09:11:08 +0000 Subject: Add 'remark' diagnostic type in 'clang' A 'remark' is information that is not an error or a warning, but rather some additional information provided to the user. In contrast to a 'note' a 'remark' is an independent diagnostic, whereas a 'note' always depends on another diagnostic. A typical use case for remark nodes is information provided to the user, e.g. information provided by the vectorizer about loops that have been vectorized. This patch provides the initial implementation of 'remarks'. It includes the actual definiton of the remark nodes, their printing as well as basic parameter handling. We are reusing the existing diagnostic parameters which means a remark can be enabled with normal '-Wdiagnostic-name' flags and can be upgraded to an error using '-Werror=diagnostic-name'. '-Werror' alone does not upgrade remarks. This patch is by intention minimal in terms of parameter handling. More experience and more discussions will most likely lead to further enhancements in the parameter handling. llvm-svn: 202475 --- clang/lib/CodeGen/CodeGenAction.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CodeGenAction.cpp') 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; -- cgit v1.2.3