mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 15:13:49 -04:00
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
This commit is contained in:
@@ -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
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Reference in New Issue
Block a user