summaryrefslogtreecommitdiff
path: root/lib/Support
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2013-09-27 21:09:25 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2013-09-27 21:09:25 +0000
commit8a93c3ab2121f8c9f0739971070b042cd6aa8024 (patch)
tree4179d68306128a02e730e1968e15fb973c62cd5e /lib/Support
parenta6610ee882fcb8bcad60d53fc52b80f00a3fddae (diff)
downloadllvm-8a93c3ab2121f8c9f0739971070b042cd6aa8024.tar.gz
llvm-8a93c3ab2121f8c9f0739971070b042cd6aa8024.tar.bz2
llvm-8a93c3ab2121f8c9f0739971070b042cd6aa8024.tar.xz
Make SourceMgr::PrintMessage() testable and add unit tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191558 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/SourceMgr.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Support/SourceMgr.cpp b/lib/Support/SourceMgr.cpp
index 51162dd342..fbcd8f980c 100644
--- a/lib/Support/SourceMgr.cpp
+++ b/lib/Support/SourceMgr.cpp
@@ -211,7 +211,8 @@ SMDiagnostic SourceMgr::GetMessage(SMLoc Loc, SourceMgr::DiagKind Kind,
LineStr, ColRanges, FixIts);
}
-void SourceMgr::PrintMessage(SMLoc Loc, SourceMgr::DiagKind Kind,
+void SourceMgr::PrintMessage(raw_ostream &OS, SMLoc Loc,
+ SourceMgr::DiagKind Kind,
const Twine &Msg, ArrayRef<SMRange> Ranges,
ArrayRef<SMFixIt> FixIts, bool ShowColors) const {
SMDiagnostic Diagnostic = GetMessage(Loc, Kind, Msg, Ranges, FixIts);
@@ -222,8 +223,6 @@ void SourceMgr::PrintMessage(SMLoc Loc, SourceMgr::DiagKind Kind,
return;
}
- raw_ostream &OS = errs();
-
if (Loc != SMLoc()) {
int CurBuf = FindBufferContainingLoc(Loc);
assert(CurBuf != -1 && "Invalid or unspecified location!");
@@ -233,6 +232,12 @@ void SourceMgr::PrintMessage(SMLoc Loc, SourceMgr::DiagKind Kind,
Diagnostic.print(0, OS, ShowColors);
}
+void SourceMgr::PrintMessage(SMLoc Loc, SourceMgr::DiagKind Kind,
+ const Twine &Msg, ArrayRef<SMRange> Ranges,
+ ArrayRef<SMFixIt> FixIts, bool ShowColors) const {
+ PrintMessage(llvm::errs(), Loc, Kind, Msg, Ranges, FixIts, ShowColors);
+}
+
//===----------------------------------------------------------------------===//
// SMDiagnostic Implementation
//===----------------------------------------------------------------------===//