summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-08-18 22:28:28 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-08-18 22:28:28 +0000
commit43d22b83dcfcac2b63c5cfd7cf23f511275a0353 (patch)
tree0701b129afa738da537267d409e13a005aecbb37 /llvm/lib/AsmParser
parent7342ca41559182c2fceea355cff5c4d853e473a7 (diff)
downloadbcm5719-llvm-43d22b83dcfcac2b63c5cfd7cf23f511275a0353.tar.gz
bcm5719-llvm-43d22b83dcfcac2b63c5cfd7cf23f511275a0353.zip
These classes only need a StringRef, not a MemoryBuffer.
llvm-svn: 215945
Diffstat (limited to 'llvm/lib/AsmParser')
-rw-r--r--llvm/lib/AsmParser/LLLexer.cpp6
-rw-r--r--llvm/lib/AsmParser/LLLexer.h4
-rw-r--r--llvm/lib/AsmParser/LLParser.h2
-rw-r--r--llvm/lib/AsmParser/Parser.cpp4
4 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp
index 4a03440caaa..cb4a9557d43 100644
--- a/llvm/lib/AsmParser/LLLexer.cpp
+++ b/llvm/lib/AsmParser/LLLexer.cpp
@@ -161,10 +161,10 @@ static const char *isLabelTail(const char *CurPtr) {
// Lexer definition.
//===----------------------------------------------------------------------===//
-LLLexer::LLLexer(MemoryBuffer *StartBuf, SourceMgr &sm, SMDiagnostic &Err,
+LLLexer::LLLexer(StringRef StartBuf, SourceMgr &sm, SMDiagnostic &Err,
LLVMContext &C)
: CurBuf(StartBuf), ErrorInfo(Err), SM(sm), Context(C), APFloatVal(0.0) {
- CurPtr = CurBuf->getBufferStart();
+ CurPtr = CurBuf.begin();
}
int LLLexer::getNextChar() {
@@ -174,7 +174,7 @@ int LLLexer::getNextChar() {
case 0:
// A nul character in the stream is either the end of the current buffer or
// a random nul in the file. Disambiguate that here.
- if (CurPtr-1 != CurBuf->getBufferEnd())
+ if (CurPtr-1 != CurBuf.end())
return 0; // Just whitespace.
// Otherwise, return end of file.
diff --git a/llvm/lib/AsmParser/LLLexer.h b/llvm/lib/AsmParser/LLLexer.h
index 683939fe62d..219827fd330 100644
--- a/llvm/lib/AsmParser/LLLexer.h
+++ b/llvm/lib/AsmParser/LLLexer.h
@@ -28,7 +28,7 @@ namespace llvm {
class LLLexer {
const char *CurPtr;
- MemoryBuffer *CurBuf;
+ StringRef CurBuf;
SMDiagnostic &ErrorInfo;
SourceMgr &SM;
LLVMContext &Context;
@@ -43,7 +43,7 @@ namespace llvm {
APSInt APSIntVal;
public:
- explicit LLLexer(MemoryBuffer *StartBuf, SourceMgr &SM, SMDiagnostic &,
+ explicit LLLexer(StringRef StartBuf, SourceMgr &SM, SMDiagnostic &,
LLVMContext &C);
~LLLexer() {}
diff --git a/llvm/lib/AsmParser/LLParser.h b/llvm/lib/AsmParser/LLParser.h
index 6a7ff9f9242..a3eb8d3ed38 100644
--- a/llvm/lib/AsmParser/LLParser.h
+++ b/llvm/lib/AsmParser/LLParser.h
@@ -136,7 +136,7 @@ namespace llvm {
std::map<unsigned, AttrBuilder> NumberedAttrBuilders;
public:
- LLParser(MemoryBuffer *F, SourceMgr &SM, SMDiagnostic &Err, Module *m) :
+ LLParser(StringRef F, SourceMgr &SM, SMDiagnostic &Err, Module *m) :
Context(m->getContext()), Lex(F, SM, Err, m->getContext()),
M(m) {}
bool Run();
diff --git a/llvm/lib/AsmParser/Parser.cpp b/llvm/lib/AsmParser/Parser.cpp
index 4cc94cb270d..6cae013b129 100644
--- a/llvm/lib/AsmParser/Parser.cpp
+++ b/llvm/lib/AsmParser/Parser.cpp
@@ -29,11 +29,11 @@ Module *llvm::ParseAssembly(std::unique_ptr<MemoryBuffer> F, Module *M,
// If we are parsing into an existing module, do it.
if (M)
- return LLParser(Buf, SM, Err, M).Run() ? nullptr : M;
+ return LLParser(Buf->getBuffer(), SM, Err, M).Run() ? nullptr : M;
// Otherwise create a new module.
std::unique_ptr<Module> M2(new Module(Buf->getBufferIdentifier(), Context));
- if (LLParser(Buf, SM, Err, M2.get()).Run())
+ if (LLParser(Buf->getBuffer(), SM, Err, M2.get()).Run())
return nullptr;
return M2.release();
}
OpenPOWER on IntegriCloud