aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-07 18:44:11 +0000
committerOwen Anderson <resistor@mac.com>2009-07-07 18:44:11 +0000
commitff6c91efcf62d1cb99343fdcb2de6271520a1981 (patch)
tree1bd4ff6073052316d21fec4e66fdc137fe948119
parent151f369c539d77c50f1c4eeb79659666a620d679 (diff)
downloadexternal_llvm-ff6c91efcf62d1cb99343fdcb2de6271520a1981.zip
external_llvm-ff6c91efcf62d1cb99343fdcb2de6271520a1981.tar.gz
external_llvm-ff6c91efcf62d1cb99343fdcb2de6271520a1981.tar.bz2
Use LLVMContext in the LLLexer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74934 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AsmParser/LLLexer.cpp8
-rw-r--r--lib/AsmParser/LLLexer.h5
-rw-r--r--lib/AsmParser/LLParser.h2
3 files changed, 10 insertions, 5 deletions
diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp
index 741c538..cab9417 100644
--- a/lib/AsmParser/LLLexer.cpp
+++ b/lib/AsmParser/LLLexer.cpp
@@ -14,6 +14,7 @@
#include "LLLexer.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Instruction.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/SourceMgr.h"
@@ -180,8 +181,9 @@ static const char *isLabelTail(const char *CurPtr) {
// Lexer definition.
//===----------------------------------------------------------------------===//
-LLLexer::LLLexer(MemoryBuffer *StartBuf, SourceMgr &sm, SMDiagnostic &Err)
- : CurBuf(StartBuf), ErrorInfo(Err), SM(sm), APFloatVal(0.0) {
+LLLexer::LLLexer(MemoryBuffer *StartBuf, SourceMgr &sm, SMDiagnostic &Err,
+ LLVMContext &C)
+ : CurBuf(StartBuf), ErrorInfo(Err), SM(sm), Context(C), APFloatVal(0.0) {
CurPtr = CurBuf->getBufferStart();
}
@@ -452,7 +454,7 @@ lltok::Kind LLLexer::LexIdentifier() {
Error("bitwidth for integer type out of range!");
return lltok::Error;
}
- TyVal = IntegerType::get(NumBits);
+ TyVal = Context.getIntegerType(NumBits);
return lltok::Type;
}
diff --git a/lib/AsmParser/LLLexer.h b/lib/AsmParser/LLLexer.h
index b5e58f1..4e05463 100644
--- a/lib/AsmParser/LLLexer.h
+++ b/lib/AsmParser/LLLexer.h
@@ -24,12 +24,14 @@ namespace llvm {
class MemoryBuffer;
class Type;
class SMDiagnostic;
+ class LLVMContext;
class LLLexer {
const char *CurPtr;
MemoryBuffer *CurBuf;
SMDiagnostic &ErrorInfo;
SourceMgr &SM;
+ LLVMContext &Context;
// Information about the current token.
const char *TokStart;
@@ -42,7 +44,8 @@ namespace llvm {
std::string TheError;
public:
- explicit LLLexer(MemoryBuffer *StartBuf, SourceMgr &SM, SMDiagnostic &);
+ explicit LLLexer(MemoryBuffer *StartBuf, SourceMgr &SM, SMDiagnostic &,
+ LLVMContext &C);
~LLLexer() {}
lltok::Kind Lex() {
diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h
index 6659620..1f053c2 100644
--- a/lib/AsmParser/LLParser.h
+++ b/lib/AsmParser/LLParser.h
@@ -74,7 +74,7 @@ namespace llvm {
std::vector<GlobalValue*> NumberedVals;
public:
LLParser(MemoryBuffer *F, SourceMgr &SM, SMDiagnostic &Err, Module *m) :
- Context(m->getContext()), Lex(F, SM, Err), M(m) {}
+ Context(m->getContext()), Lex(F, SM, Err, m->getContext()), M(m) {}
bool Run();
LLVMContext& getContext() { return Context; }