Add 'remark' diagnostic type in LLVM

Tobias Grosser tobias at grosser.es
Tue Feb 25 02:18:18 PST 2014


Hi,

I would like to add the following patch.

--------------
Add 'remark' diagnostic type in LLVM

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.
--------------

A review would be highly appreciated.

Tobias

-------------- next part --------------
>From ffbf73ec54a361b0352445e24c6abbf9d8f2c788 Mon Sep 17 00:00:00 2001
From: Tobias Grosser <tobias at grosser.es>
Date: Tue, 25 Feb 2014 09:50:23 +0100
Subject: [PATCH] Add 'remark' diagnostic type in LLVM

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.
---
 include/llvm-c/lto.h             | 1 +
 include/llvm/IR/DiagnosticInfo.h | 3 +++
 lib/IR/LLVMContext.cpp           | 3 +++
 lib/LTO/LTOCodeGenerator.cpp     | 3 +++
 4 files changed, 10 insertions(+)

diff --git a/include/llvm-c/lto.h b/include/llvm-c/lto.h
index bff63ad..a9ea759 100644
--- a/include/llvm-c/lto.h
+++ b/include/llvm-c/lto.h
@@ -301,6 +301,7 @@ lto_module_get_linkeropt(lto_module_t mod, unsigned int index);
 typedef enum {
   LTO_DS_ERROR,
   LTO_DS_WARNING,
+  LTO_DS_REMARK,
   LTO_DS_NOTE
 } lto_codegen_diagnostic_severity_t;
 
diff --git a/include/llvm/IR/DiagnosticInfo.h b/include/llvm/IR/DiagnosticInfo.h
index 4c7af89..9b99ce6 100644
--- a/include/llvm/IR/DiagnosticInfo.h
+++ b/include/llvm/IR/DiagnosticInfo.h
@@ -31,6 +31,9 @@ class Value;
 enum DiagnosticSeverity {
   DS_Error,
   DS_Warning,
+  DS_Remark,
+  // A note attaches additional information to one of the previous diagnostic
+  // types.
   DS_Note
 };
 
diff --git a/lib/IR/LLVMContext.cpp b/lib/IR/LLVMContext.cpp
index d9d6de1..1bfc515 100644
--- a/lib/IR/LLVMContext.cpp
+++ b/lib/IR/LLVMContext.cpp
@@ -142,6 +142,9 @@ void LLVMContext::diagnose(const DiagnosticInfo &DI) {
   case DS_Warning:
     errs() << "warning: " << MsgStorage << "\n";
     break;
+  case DS_Remark:
+    errs() << "remark: " << MsgStorage << "\n";
+    break;
   case DS_Note:
     errs() << "note: " << MsgStorage << "\n";
     break;
diff --git a/lib/LTO/LTOCodeGenerator.cpp b/lib/LTO/LTOCodeGenerator.cpp
index fb272ad5..924d7bc 100644
--- a/lib/LTO/LTOCodeGenerator.cpp
+++ b/lib/LTO/LTOCodeGenerator.cpp
@@ -561,6 +561,9 @@ void LTOCodeGenerator::DiagnosticHandler2(const DiagnosticInfo &DI) {
   case DS_Warning:
     Severity = LTO_DS_WARNING;
     break;
+  case DS_Remark:
+    Severity = LTO_DS_REMARK;
+    break;
   case DS_Note:
     Severity = LTO_DS_NOTE;
     break;
-- 
1.8.1.2



More information about the llvm-commits mailing list