Add 'remark' diagnostic type in LLVM
authorTobias Grosser <tobias@grosser.es>
Fri, 28 Feb 2014 09:08:45 +0000 (09:08 +0000)
committerTobias Grosser <tobias@grosser.es>
Fri, 28 Feb 2014 09:08:45 +0000 (09:08 +0000)
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.

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

include/llvm-c/lto.h
include/llvm/IR/DiagnosticInfo.h
lib/IR/LLVMContext.cpp
lib/LTO/LTOCodeGenerator.cpp

index bff63ad09690d2c25483a80cbd046cd9968544f2..87904c208cc23693d76c07712ea978223b7481ec 100644 (file)
@@ -40,7 +40,7 @@ typedef bool lto_bool_t;
  * @{
  */
 
-#define LTO_API_VERSION 9
+#define LTO_API_VERSION 10
 
 /**
  * \since prior to LTO_API_VERSION=3
@@ -299,9 +299,10 @@ lto_module_get_linkeropt(lto_module_t mod, unsigned int index);
  * \since LTO_API_VERSION=7
  */
 typedef enum {
-  LTO_DS_ERROR,
-  LTO_DS_WARNING,
-  LTO_DS_NOTE
+  LTO_DS_ERROR = 0,
+  LTO_DS_WARNING = 1,
+  LTO_DS_REMARK = 3, // Added in LTO_API_VERSION=10.
+  LTO_DS_NOTE = 2
 } lto_codegen_diagnostic_severity_t;
 
 /**
index 4c7af89d72fa26db343e1b380c3e28388bf16aef..9b99ce6cd783e4725729c2e56d8c03a585ec3d2a 100644 (file)
@@ -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
 };
 
index d9d6de15447106b2752c75b0872f3c1ae3b42b49..1bfc51527735d795c6231b39e7d7fba17ebe8ff0 100644 (file)
@@ -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;
index c5f98736c00fb182cdc4ec0e124c42bd34568097..777db9c9128db2057a6443febe4856266bb3c854 100644 (file)
@@ -562,6 +562,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;