llvm.org GIT mirror llvm / 18264d1
Add DK_Remark to SMDiagnostic Swift uses SMDiagnostic for diagnostic messages. For https://github.com/apple/swift/pull/12294, we need remark support. I picked the color that clang uses to display them. Differential Revision: https://reviews.llvm.org/D38865 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315642 91177308-0d34-0410-b5e6-96231b3b80d8 Adam Nemet 1 year, 11 months ago
4 changed file(s) with 20 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
4242 enum DiagKind {
4343 DK_Error,
4444 DK_Warning,
45 DK_Note
45 DK_Remark,
46 DK_Note,
4647 };
4748
4849 /// Clients that want to handle their own diagnostics in a custom way can
213213 case SourceMgr::DK_Note:
214214 Kind = DS_Note;
215215 break;
216 case SourceMgr::DK_Remark:
217 llvm_unreachable("remark unexpected");
218 break;
216219 }
217220 Context.diagnose(DiagnosticInfoMIRParser(Kind, Diag));
218221 }
383383 S.changeColor(raw_ostream::BLACK, true);
384384 S << "note: ";
385385 break;
386 case SourceMgr::DK_Remark:
387 if (ShowColors)
388 S.changeColor(raw_ostream::BLUE, true);
389 S << "remark: ";
390 break;
386391 }
387392
388393 if (ShowColors) {
6161 printMessage(getLoc(4), SourceMgr::DK_Warning, "message", None, None);
6262
6363 EXPECT_EQ("file.in:1:5: warning: message\n"
64 "aaa bbb\n"
65 " ^\n",
66 Output);
67 }
68
69 TEST_F(SourceMgrTest, BasicRemark) {
70 setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
71 printMessage(getLoc(4), SourceMgr::DK_Remark, "message", None, None);
72
73 EXPECT_EQ("file.in:1:5: remark: message\n"
6474 "aaa bbb\n"
6575 " ^\n",
6676 Output);