Give llvm::SourceMgr the ability to have a client-specified

diagnostic handler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100503 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-04-06 00:26:48 +00:00
parent a03948633a
commit 8f0f480a10
4 changed files with 43 additions and 9 deletions
+8 -1
View File
@@ -168,13 +168,20 @@ SMDiagnostic SourceMgr::GetMessage(SMLoc Loc, const std::string &Msg,
}
PrintedMsg += Msg;
return SMDiagnostic(CurMB->getBufferIdentifier(), FindLineNumber(Loc, CurBuf),
return SMDiagnostic(Loc,
CurMB->getBufferIdentifier(), FindLineNumber(Loc, CurBuf),
Loc.getPointer()-LineStart, PrintedMsg,
LineStr, ShowLine);
}
void SourceMgr::PrintMessage(SMLoc Loc, const std::string &Msg,
const char *Type, bool ShowLine) const {
// Report the message with the diagnostic handler if present.
if (DiagHandler) {
DiagHandler(GetMessage(Loc, Msg, Type, ShowLine), DiagContext);
return;
}
raw_ostream &OS = errs();
int CurBuf = FindBufferContainingLoc(Loc);