MC: Move getLoc() to MCAsmLexer().
authorDaniel Dunbar <daniel@zuster.org>
Mon, 12 Jul 2010 17:10:00 +0000 (17:10 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 12 Jul 2010 17:10:00 +0000 (17:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108154 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCParser/AsmLexer.h
include/llvm/MC/MCParser/MCAsmLexer.h
lib/MC/MCParser/AsmLexer.cpp
lib/MC/MCParser/MCAsmLexer.cpp

index cf6eefb4083103160f21f9d01abf916e3745656e..94e24acce09e12c5ea278e6ece75f0c52bd4b536 100644 (file)
@@ -33,8 +33,6 @@ class AsmLexer : public MCAsmLexer {
   const char *CurPtr;
   const MemoryBuffer *CurBuf;
   
-  const char *TokStart;
-  
   void operator=(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);
   
-  SMLoc getLoc() const;
-  
   StringRef LexUntilEndOfStatement();
 
   bool isAtStartOfComment(char Char);
index bd1496f35a25948dbfb5215ddef55aeb91c32f92..9ae9c420ebe3cebf552f3a50093eb832eadcf900 100644 (file)
@@ -121,6 +121,8 @@ class MCAsmLexer {
   MCAsmLexer(const MCAsmLexer &);   // DO NOT IMPLEMENT
   void operator=(const MCAsmLexer &);  // DO NOT IMPLEMENT
 protected: // Can only create subclasses.
+  const char *TokStart;
+
   MCAsmLexer();
 
   virtual AsmToken LexToken() = 0;
@@ -141,6 +143,9 @@ public:
     return CurTok = LexToken();
   }
 
+  /// getLoc - Get the current source location.
+  SMLoc getLoc() const;
+
   /// getTok - Get the current (last) lexed token.
   const AsmToken &getTok() {
     return CurTok;
index d696a4184e9c13dfc181507db85645d27ce6865e..465d98382877b83b83efa1a8b0b9463bf1909de4 100644 (file)
@@ -23,7 +23,6 @@ using namespace llvm;
 AsmLexer::AsmLexer(const MCAsmInfo &_MAI) : MAI(_MAI)  {
   CurBuf = NULL;
   CurPtr = NULL;
-  TokStart = 0;
 }
 
 AsmLexer::~AsmLexer() {
@@ -40,10 +39,6 @@ void AsmLexer::setBuffer(const MemoryBuffer *buf, const char *ptr) {
   TokStart = 0;
 }
 
-SMLoc AsmLexer::getLoc() const {
-  return SMLoc::getFromPointer(TokStart);
-}
-
 /// ReturnError - Set the error to the specified string at the specified
 /// location.  This is defined to always return AsmToken::Error.
 AsmToken AsmLexer::ReturnError(const char *Loc, const std::string &Msg) {
index e5b29550966965f854c8a682e72687a87711f224..dceece78ba10b8a7fb1fca774474a3a93fc18340 100644 (file)
 
 using namespace llvm;
 
-MCAsmLexer::MCAsmLexer() : CurTok(AsmToken::Error, StringRef()) {
+MCAsmLexer::MCAsmLexer() : CurTok(AsmToken::Error, StringRef()), TokStart(0) {
 }
 
 MCAsmLexer::~MCAsmLexer() {
 }
 
+SMLoc MCAsmLexer::getLoc() const {
+  return SMLoc::getFromPointer(TokStart);
+}
+
 SMLoc AsmToken::getLoc() const {
   return SMLoc::getFromPointer(Str.data());
 }