switch the .ll parser into SMDiagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74734 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2009-07-02 22:46:18 +00:00
parent 7e1e31f467
commit 92bcb426c3
7 changed files with 26 additions and 105 deletions

View File

@ -16,6 +16,7 @@
#include "llvm/Instruction.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Assembly/Parser.h"
#include <cstdlib>
@ -38,8 +39,9 @@ bool LLLexer::Error(LocTy ErrorLoc, const std::string &Msg) const {
for (const char *FP = CurBuf->getBufferStart(); FP != ErrorLoc; ++FP)
if (*FP == '\n') ++LineNo;
std::string LineContents(LineStart, LineEnd);
ErrorInfo.setError(Msg, LineNo, ErrorLoc-LineStart, LineContents);
ErrorInfo = SMDiagnostic(CurBuf->getBufferIdentifier(),
LineNo, ErrorLoc-LineStart, Msg,
std::string(LineStart, LineEnd));
return true;
}
@ -195,7 +197,7 @@ static const char *isLabelTail(const char *CurPtr) {
// Lexer definition.
//===----------------------------------------------------------------------===//
LLLexer::LLLexer(MemoryBuffer *StartBuf, ParseError &Err)
LLLexer::LLLexer(MemoryBuffer *StartBuf, SMDiagnostic &Err)
: CurBuf(StartBuf), ErrorInfo(Err), APFloatVal(0.0) {
CurPtr = CurBuf->getBufferStart();
}