[PATCH] D38865: Add DK_Remark to SMDiagnostic

Adam Nemet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 12 16:56:21 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL315642: Add DK_Remark to SMDiagnostic (authored by anemet).

Repository:
  rL LLVM

https://reviews.llvm.org/D38865

Files:
  llvm/trunk/include/llvm/Support/SourceMgr.h
  llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp
  llvm/trunk/lib/Support/SourceMgr.cpp
  llvm/trunk/unittests/Support/SourceMgrTest.cpp


Index: llvm/trunk/lib/Support/SourceMgr.cpp
===================================================================
--- llvm/trunk/lib/Support/SourceMgr.cpp
+++ llvm/trunk/lib/Support/SourceMgr.cpp
@@ -384,6 +384,11 @@
         S.changeColor(raw_ostream::BLACK, true);
       S << "note: ";
       break;
+    case SourceMgr::DK_Remark:
+      if (ShowColors)
+        S.changeColor(raw_ostream::BLUE, true);
+      S << "remark: ";
+      break;
     }
 
     if (ShowColors) {
Index: llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp
+++ llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp
@@ -214,6 +214,9 @@
   case SourceMgr::DK_Note:
     Kind = DS_Note;
     break;
+  case SourceMgr::DK_Remark:
+    llvm_unreachable("remark unexpected");
+    break;
   }
   Context.diagnose(DiagnosticInfoMIRParser(Kind, Diag));
 }
Index: llvm/trunk/unittests/Support/SourceMgrTest.cpp
===================================================================
--- llvm/trunk/unittests/Support/SourceMgrTest.cpp
+++ llvm/trunk/unittests/Support/SourceMgrTest.cpp
@@ -67,6 +67,16 @@
             Output);
 }
 
+TEST_F(SourceMgrTest, BasicRemark) {
+  setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
+  printMessage(getLoc(4), SourceMgr::DK_Remark, "message", None, None);
+
+  EXPECT_EQ("file.in:1:5: remark: message\n"
+            "aaa bbb\n"
+            "    ^\n",
+            Output);
+}
+
 TEST_F(SourceMgrTest, BasicNote) {
   setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
   printMessage(getLoc(4), SourceMgr::DK_Note, "message", None, None);
Index: llvm/trunk/include/llvm/Support/SourceMgr.h
===================================================================
--- llvm/trunk/include/llvm/Support/SourceMgr.h
+++ llvm/trunk/include/llvm/Support/SourceMgr.h
@@ -43,7 +43,8 @@
   enum DiagKind {
     DK_Error,
     DK_Warning,
-    DK_Note
+    DK_Remark,
+    DK_Note,
   };
 
   /// Clients that want to handle their own diagnostics in a custom way can


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38865.118862.patch
Type: text/x-patch
Size: 2058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171012/9256f739/attachment.bin>


More information about the llvm-commits mailing list