mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 21:18:19 +00:00
switch the .ll parser to use SourceMgr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74735 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
+21
-10
@@ -90,17 +90,19 @@ void SourceMgr::PrintIncludeStack(SMLoc IncludeLoc, raw_ostream &OS) const {
|
||||
}
|
||||
|
||||
|
||||
void SourceMgr::PrintMessage(SMLoc Loc, const std::string &Msg,
|
||||
const char *Type) const {
|
||||
raw_ostream &OS = errs();
|
||||
/// GetMessage - Return an SMDiagnostic at the specified location with the
|
||||
/// specified string.
|
||||
///
|
||||
/// @param Type - If non-null, the kind of message (e.g., "error") which is
|
||||
/// prefixed to the message.
|
||||
SMDiagnostic SourceMgr::GetMessage(SMLoc Loc, const std::string &Msg,
|
||||
const char *Type) const {
|
||||
|
||||
// First thing to do: find the current buffer containing the specified
|
||||
// location.
|
||||
int CurBuf = FindBufferContainingLoc(Loc);
|
||||
assert(CurBuf != -1 && "Invalid or unspecified location!");
|
||||
|
||||
PrintIncludeStack(getBufferInfo(CurBuf).IncludeLoc, OS);
|
||||
|
||||
MemoryBuffer *CurMB = getBufferInfo(CurBuf).Buffer;
|
||||
|
||||
|
||||
@@ -122,12 +124,21 @@ void SourceMgr::PrintMessage(SMLoc Loc, const std::string &Msg,
|
||||
}
|
||||
PrintedMsg += Msg;
|
||||
|
||||
|
||||
// Print out the line.
|
||||
SMDiagnostic(CurMB->getBufferIdentifier(), FindLineNumber(Loc, CurBuf),
|
||||
Loc.getPointer()-LineStart, PrintedMsg,
|
||||
std::string(LineStart, LineEnd)).Print(0, OS);
|
||||
|
||||
return SMDiagnostic(CurMB->getBufferIdentifier(), FindLineNumber(Loc, CurBuf),
|
||||
Loc.getPointer()-LineStart, PrintedMsg,
|
||||
std::string(LineStart, LineEnd));
|
||||
}
|
||||
|
||||
void SourceMgr::PrintMessage(SMLoc Loc, const std::string &Msg,
|
||||
const char *Type) const {
|
||||
raw_ostream &OS = errs();
|
||||
|
||||
int CurBuf = FindBufferContainingLoc(Loc);
|
||||
assert(CurBuf != -1 && "Invalid or unspecified location!");
|
||||
PrintIncludeStack(getBufferInfo(CurBuf).IncludeLoc, OS);
|
||||
|
||||
GetMessage(Loc, Msg, Type).Print(0, OS);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Reference in New Issue
Block a user