mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 23:17:16 +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:
@@ -24,24 +24,7 @@
|
||||
using namespace llvm;
|
||||
|
||||
bool LLLexer::Error(LocTy ErrorLoc, const std::string &Msg) const {
|
||||
// Scan backward to find the start of the line.
|
||||
const char *LineStart = ErrorLoc;
|
||||
while (LineStart != CurBuf->getBufferStart() &&
|
||||
LineStart[-1] != '\n' && LineStart[-1] != '\r')
|
||||
--LineStart;
|
||||
// Get the end of the line.
|
||||
const char *LineEnd = ErrorLoc;
|
||||
while (LineEnd != CurBuf->getBufferEnd() &&
|
||||
LineEnd[0] != '\n' && LineEnd[0] != '\r')
|
||||
++LineEnd;
|
||||
|
||||
unsigned LineNo = 1;
|
||||
for (const char *FP = CurBuf->getBufferStart(); FP != ErrorLoc; ++FP)
|
||||
if (*FP == '\n') ++LineNo;
|
||||
|
||||
ErrorInfo = SMDiagnostic(CurBuf->getBufferIdentifier(),
|
||||
LineNo, ErrorLoc-LineStart, Msg,
|
||||
std::string(LineStart, LineEnd));
|
||||
ErrorInfo = SM.GetMessage(ErrorLoc, Msg, "error");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -197,8 +180,8 @@ static const char *isLabelTail(const char *CurPtr) {
|
||||
// Lexer definition.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
LLLexer::LLLexer(MemoryBuffer *StartBuf, SMDiagnostic &Err)
|
||||
: CurBuf(StartBuf), ErrorInfo(Err), APFloatVal(0.0) {
|
||||
LLLexer::LLLexer(MemoryBuffer *StartBuf, SourceMgr &sm, SMDiagnostic &Err)
|
||||
: CurBuf(StartBuf), ErrorInfo(Err), SM(sm), APFloatVal(0.0) {
|
||||
CurPtr = CurBuf->getBufferStart();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user