summaryrefslogtreecommitdiff
path: root/lib/Support
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2014-06-17 02:15:40 +0000
committerJordan Rose <jordan_rose@apple.com>2014-06-17 02:15:40 +0000
commit4e23baa9454b3826b2dc291fb4ac683bf32a19de (patch)
treea562329cb008d8d0b9c067baba52de060cb84d07 /lib/Support
parentecb1c3aa8c574243f461a62b9e5976f1961cd476 (diff)
downloadllvm-4e23baa9454b3826b2dc291fb4ac683bf32a19de.tar.gz
llvm-4e23baa9454b3826b2dc291fb4ac683bf32a19de.tar.bz2
llvm-4e23baa9454b3826b2dc291fb4ac683bf32a19de.tar.xz
Add an overload for SourceMgr::PrintMessage that takes an existing diagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211087 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/SourceMgr.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/Support/SourceMgr.cpp b/lib/Support/SourceMgr.cpp
index 6d530e6fa0..4d00d3baa4 100644
--- a/lib/Support/SourceMgr.cpp
+++ b/lib/Support/SourceMgr.cpp
@@ -199,20 +199,16 @@ SMDiagnostic SourceMgr::GetMessage(SMLoc Loc, SourceMgr::DiagKind Kind,
LineStr, ColRanges, FixIts);
}
-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);
-
+void SourceMgr::PrintMessage(raw_ostream &OS, const SMDiagnostic &Diagnostic,
+ bool ShowColors) const {
// Report the message with the diagnostic handler if present.
if (DiagHandler) {
DiagHandler(Diagnostic, DiagContext);
return;
}
- if (Loc != SMLoc()) {
- int CurBuf = FindBufferContainingLoc(Loc);
+ if (Diagnostic.getLoc().isValid()) {
+ int CurBuf = FindBufferContainingLoc(Diagnostic.getLoc());
assert(CurBuf != -1 && "Invalid or unspecified location!");
PrintIncludeStack(getBufferInfo(CurBuf).IncludeLoc, OS);
}
@@ -220,6 +216,13 @@ void SourceMgr::PrintMessage(raw_ostream &OS, SMLoc Loc,
Diagnostic.print(nullptr, OS, ShowColors);
}
+void SourceMgr::PrintMessage(raw_ostream &OS, SMLoc Loc,
+ SourceMgr::DiagKind Kind,
+ const Twine &Msg, ArrayRef<SMRange> Ranges,
+ ArrayRef<SMFixIt> FixIts, bool ShowColors) const {
+ PrintMessage(OS, GetMessage(Loc, Kind, Msg, Ranges, FixIts), ShowColors);
+}
+
void SourceMgr::PrintMessage(SMLoc Loc, SourceMgr::DiagKind Kind,
const Twine &Msg, ArrayRef<SMRange> Ranges,
ArrayRef<SMFixIt> FixIts, bool ShowColors) const {