MC: Move getLoc() to MCAsmLexer().

llvm-svn: 108154
This commit is contained in:
Daniel Dunbar 2010-07-12 17:10:00 +00:00
parent 8f36402ac2
commit 4042c33cd8
4 changed files with 10 additions and 10 deletions

View File

@ -33,8 +33,6 @@ class AsmLexer : public MCAsmLexer {
const char *CurPtr; const char *CurPtr;
const MemoryBuffer *CurBuf; const MemoryBuffer *CurBuf;
const char *TokStart;
void operator=(const AsmLexer&); // DO NOT IMPLEMENT void operator=(const AsmLexer&); // DO NOT IMPLEMENT
AsmLexer(const AsmLexer&); // DO NOT IMPLEMENT AsmLexer(const AsmLexer&); // DO NOT IMPLEMENT
@ -48,8 +46,6 @@ public:
void setBuffer(const MemoryBuffer *buf, const char *ptr = NULL); void setBuffer(const MemoryBuffer *buf, const char *ptr = NULL);
SMLoc getLoc() const;
StringRef LexUntilEndOfStatement(); StringRef LexUntilEndOfStatement();
bool isAtStartOfComment(char Char); bool isAtStartOfComment(char Char);

View File

@ -121,6 +121,8 @@ class MCAsmLexer {
MCAsmLexer(const MCAsmLexer &); // DO NOT IMPLEMENT MCAsmLexer(const MCAsmLexer &); // DO NOT IMPLEMENT
void operator=(const MCAsmLexer &); // DO NOT IMPLEMENT void operator=(const MCAsmLexer &); // DO NOT IMPLEMENT
protected: // Can only create subclasses. protected: // Can only create subclasses.
const char *TokStart;
MCAsmLexer(); MCAsmLexer();
virtual AsmToken LexToken() = 0; virtual AsmToken LexToken() = 0;
@ -141,6 +143,9 @@ public:
return CurTok = LexToken(); return CurTok = LexToken();
} }
/// getLoc - Get the current source location.
SMLoc getLoc() const;
/// getTok - Get the current (last) lexed token. /// getTok - Get the current (last) lexed token.
const AsmToken &getTok() { const AsmToken &getTok() {
return CurTok; return CurTok;

View File

@ -23,7 +23,6 @@ using namespace llvm;
AsmLexer::AsmLexer(const MCAsmInfo &_MAI) : MAI(_MAI) { AsmLexer::AsmLexer(const MCAsmInfo &_MAI) : MAI(_MAI) {
CurBuf = NULL; CurBuf = NULL;
CurPtr = NULL; CurPtr = NULL;
TokStart = 0;
} }
AsmLexer::~AsmLexer() { AsmLexer::~AsmLexer() {
@ -40,10 +39,6 @@ void AsmLexer::setBuffer(const MemoryBuffer *buf, const char *ptr) {
TokStart = 0; TokStart = 0;
} }
SMLoc AsmLexer::getLoc() const {
return SMLoc::getFromPointer(TokStart);
}
/// ReturnError - Set the error to the specified string at the specified /// ReturnError - Set the error to the specified string at the specified
/// location. This is defined to always return AsmToken::Error. /// location. This is defined to always return AsmToken::Error.
AsmToken AsmLexer::ReturnError(const char *Loc, const std::string &Msg) { AsmToken AsmLexer::ReturnError(const char *Loc, const std::string &Msg) {

View File

@ -12,12 +12,16 @@
using namespace llvm; using namespace llvm;
MCAsmLexer::MCAsmLexer() : CurTok(AsmToken::Error, StringRef()) { MCAsmLexer::MCAsmLexer() : CurTok(AsmToken::Error, StringRef()), TokStart(0) {
} }
MCAsmLexer::~MCAsmLexer() { MCAsmLexer::~MCAsmLexer() {
} }
SMLoc MCAsmLexer::getLoc() const {
return SMLoc::getFromPointer(TokStart);
}
SMLoc AsmToken::getLoc() const { SMLoc AsmToken::getLoc() const {
return SMLoc::getFromPointer(Str.data()); return SMLoc::getFromPointer(Str.data());
} }