mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
Use LLVMContext in the LLLexer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74934 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
151f369c53
commit
ff6c91efcf
@ -14,6 +14,7 @@
|
|||||||
#include "LLLexer.h"
|
#include "LLLexer.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Instruction.h"
|
#include "llvm/Instruction.h"
|
||||||
|
#include "llvm/LLVMContext.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/SourceMgr.h"
|
#include "llvm/Support/SourceMgr.h"
|
||||||
@ -180,8 +181,9 @@ static const char *isLabelTail(const char *CurPtr) {
|
|||||||
// Lexer definition.
|
// Lexer definition.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
LLLexer::LLLexer(MemoryBuffer *StartBuf, SourceMgr &sm, SMDiagnostic &Err)
|
LLLexer::LLLexer(MemoryBuffer *StartBuf, SourceMgr &sm, SMDiagnostic &Err,
|
||||||
: CurBuf(StartBuf), ErrorInfo(Err), SM(sm), APFloatVal(0.0) {
|
LLVMContext &C)
|
||||||
|
: CurBuf(StartBuf), ErrorInfo(Err), SM(sm), Context(C), APFloatVal(0.0) {
|
||||||
CurPtr = CurBuf->getBufferStart();
|
CurPtr = CurBuf->getBufferStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,7 +454,7 @@ lltok::Kind LLLexer::LexIdentifier() {
|
|||||||
Error("bitwidth for integer type out of range!");
|
Error("bitwidth for integer type out of range!");
|
||||||
return lltok::Error;
|
return lltok::Error;
|
||||||
}
|
}
|
||||||
TyVal = IntegerType::get(NumBits);
|
TyVal = Context.getIntegerType(NumBits);
|
||||||
return lltok::Type;
|
return lltok::Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,12 +24,14 @@ namespace llvm {
|
|||||||
class MemoryBuffer;
|
class MemoryBuffer;
|
||||||
class Type;
|
class Type;
|
||||||
class SMDiagnostic;
|
class SMDiagnostic;
|
||||||
|
class LLVMContext;
|
||||||
|
|
||||||
class LLLexer {
|
class LLLexer {
|
||||||
const char *CurPtr;
|
const char *CurPtr;
|
||||||
MemoryBuffer *CurBuf;
|
MemoryBuffer *CurBuf;
|
||||||
SMDiagnostic &ErrorInfo;
|
SMDiagnostic &ErrorInfo;
|
||||||
SourceMgr &SM;
|
SourceMgr &SM;
|
||||||
|
LLVMContext &Context;
|
||||||
|
|
||||||
// Information about the current token.
|
// Information about the current token.
|
||||||
const char *TokStart;
|
const char *TokStart;
|
||||||
@ -42,7 +44,8 @@ namespace llvm {
|
|||||||
|
|
||||||
std::string TheError;
|
std::string TheError;
|
||||||
public:
|
public:
|
||||||
explicit LLLexer(MemoryBuffer *StartBuf, SourceMgr &SM, SMDiagnostic &);
|
explicit LLLexer(MemoryBuffer *StartBuf, SourceMgr &SM, SMDiagnostic &,
|
||||||
|
LLVMContext &C);
|
||||||
~LLLexer() {}
|
~LLLexer() {}
|
||||||
|
|
||||||
lltok::Kind Lex() {
|
lltok::Kind Lex() {
|
||||||
|
@ -74,7 +74,7 @@ namespace llvm {
|
|||||||
std::vector<GlobalValue*> NumberedVals;
|
std::vector<GlobalValue*> NumberedVals;
|
||||||
public:
|
public:
|
||||||
LLParser(MemoryBuffer *F, SourceMgr &SM, SMDiagnostic &Err, Module *m) :
|
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();
|
bool Run();
|
||||||
|
|
||||||
LLVMContext& getContext() { return Context; }
|
LLVMContext& getContext() { return Context; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user