summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser/LLLexer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-02 23:08:13 +0000
committerChris Lattner <sabre@nondot.org>2009-07-02 23:08:13 +0000
commit200e0757c7411bd9ddf6ec17672f9f7bc27ffa4f (patch)
tree12fbb9dd1d8614d32db468a5693b4883eab3e614 /llvm/lib/AsmParser/LLLexer.cpp
parenta76611a5359456f9a77d55b8e01889af7e7284a9 (diff)
downloadbcm5719-llvm-200e0757c7411bd9ddf6ec17672f9f7bc27ffa4f.tar.gz
bcm5719-llvm-200e0757c7411bd9ddf6ec17672f9f7bc27ffa4f.zip
switch the .ll parser to use SourceMgr.
llvm-svn: 74735
Diffstat (limited to 'llvm/lib/AsmParser/LLLexer.cpp')
-rw-r--r--llvm/lib/AsmParser/LLLexer.cpp23
1 files changed, 3 insertions, 20 deletions
diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp
index 090e6141227..741c5381fc7 100644
--- a/llvm/lib/AsmParser/LLLexer.cpp
+++ b/llvm/lib/AsmParser/LLLexer.cpp
@@ -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();
}
OpenPOWER on IntegriCloud