Moved InstallLexer() from the X86-specific AsmLexer
to the TargetAsmLexer class so that clients can
actually use the TargetAsmLexer they get from a
Target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94940 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/TargetAsmLexer.cpp b/lib/Target/TargetAsmLexer.cpp
index 0ae6c14..d4893ff 100644
--- a/lib/Target/TargetAsmLexer.cpp
+++ b/lib/Target/TargetAsmLexer.cpp
@@ -10,5 +10,5 @@
#include "llvm/Target/TargetAsmLexer.h"
using namespace llvm;
-TargetAsmLexer::TargetAsmLexer(const Target &T) : TheTarget(T) {}
+TargetAsmLexer::TargetAsmLexer(const Target &T) : TheTarget(T), Lexer(NULL) {}
TargetAsmLexer::~TargetAsmLexer() {}
diff --git a/lib/Target/X86/AsmParser/X86AsmLexer.cpp b/lib/Target/X86/AsmParser/X86AsmLexer.cpp
index 3998b08..7197217 100644
--- a/lib/Target/X86/AsmParser/X86AsmLexer.cpp
+++ b/lib/Target/X86/AsmParser/X86AsmLexer.cpp
@@ -22,13 +22,12 @@
class X86AsmLexer : public TargetAsmLexer {
const MCAsmInfo &AsmInfo;
- MCAsmLexer *Lexer;
bool tentativeIsValid;
AsmToken tentativeToken;
const AsmToken &lexTentative() {
- tentativeToken = Lexer->Lex();
+ tentativeToken = getLexer()->Lex();
tentativeIsValid = true;
return tentativeToken;
}
@@ -39,7 +38,7 @@
return tentativeToken;
}
else {
- return Lexer->Lex();
+ return getLexer()->Lex();
}
}
@@ -64,11 +63,7 @@
}
public:
X86AsmLexer(const Target &T, const MCAsmInfo &MAI)
- : TargetAsmLexer(T), AsmInfo(MAI), Lexer(NULL), tentativeIsValid(false) {
- }
-
- void InstallLexer(MCAsmLexer &L) {
- Lexer = &L;
+ : TargetAsmLexer(T), AsmInfo(MAI), tentativeIsValid(false) {
}
};