summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/Support/SourceMgr.h3
-rw-r--r--llvm/lib/CodeGen/MIRParser/MIRParser.cpp3
-rw-r--r--llvm/lib/Support/SourceMgr.cpp5
-rw-r--r--llvm/unittests/Support/SourceMgrTest.cpp10
4 files changed, 20 insertions, 1 deletions
diff --git a/llvm/include/llvm/Support/SourceMgr.h b/llvm/include/llvm/Support/SourceMgr.h
index 399f8dcd76f..c08bf858760 100644
--- a/llvm/include/llvm/Support/SourceMgr.h
+++ b/llvm/include/llvm/Support/SourceMgr.h
@@ -43,7 +43,8 @@ public:
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
diff --git a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp
index db566963918..c91255f9592 100644
--- a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp
@@ -214,6 +214,9 @@ void MIRParserImpl::reportDiagnostic(const SMDiagnostic &Diag) {
case SourceMgr::DK_Note:
Kind = DS_Note;
break;
+ case SourceMgr::DK_Remark:
+ llvm_unreachable("remark unexpected");
+ break;
}
Context.diagnose(DiagnosticInfoMIRParser(Kind, Diag));
}
diff --git a/llvm/lib/Support/SourceMgr.cpp b/llvm/lib/Support/SourceMgr.cpp
index b0609d4fe04..a8f6208a558 100644
--- a/llvm/lib/Support/SourceMgr.cpp
+++ b/llvm/lib/Support/SourceMgr.cpp
@@ -384,6 +384,11 @@ void SMDiagnostic::print(const char *ProgName, raw_ostream &S, bool ShowColors,
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) {
diff --git a/llvm/unittests/Support/SourceMgrTest.cpp b/llvm/unittests/Support/SourceMgrTest.cpp
index 79c2d7278f1..2a84a89912a 100644
--- a/llvm/unittests/Support/SourceMgrTest.cpp
+++ b/llvm/unittests/Support/SourceMgrTest.cpp
@@ -67,6 +67,16 @@ TEST_F(SourceMgrTest, BasicWarning) {
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);
OpenPOWER on IntegriCloud