MCParser: Replace deprecated alias MCAsmLexer with AsmLexer

This commit is contained in:
Fangrui Song
2025-05-25 12:08:39 -07:00
parent d2eec93f7c
commit cb7d68a77b
17 changed files with 31 additions and 31 deletions

View File

@@ -163,8 +163,8 @@ public:
MCContext &getContext() { return Ctx; }
MCStreamer &getStreamer() { return Out; }
SourceMgr &getSourceManager() { return SrcMgr; }
MCAsmLexer &getLexer() { return Lexer; }
const MCAsmLexer &getLexer() const { return Lexer; }
AsmLexer &getLexer() { return Lexer; }
const AsmLexer &getLexer() const { return Lexer; }
MCTargetAsmParser &getTargetParser() const { return *TargetParser; }
void setTargetParser(MCTargetAsmParser &P);

View File

@@ -53,8 +53,8 @@ public:
MCContext &getContext() { return getParser().getContext(); }
MCAsmLexer &getLexer() { return getParser().getLexer(); }
const MCAsmLexer &getLexer() const {
AsmLexer &getLexer() { return getParser().getLexer(); }
const AsmLexer &getLexer() const {
return const_cast<MCAsmParserExtension *>(this)->getLexer();
}

View File

@@ -713,7 +713,7 @@ private:
class HLASMAsmParser final : public AsmParser {
private:
MCAsmLexer &Lexer;
AsmLexer &Lexer;
MCStreamer &Out;
void lexLeadingSpaces() {

View File

@@ -394,7 +394,7 @@ bool ELFAsmParser::parseDirectiveSection(StringRef, SMLoc loc) {
}
bool ELFAsmParser::maybeParseSectionType(StringRef &TypeName) {
MCAsmLexer &L = getLexer();
AsmLexer &L = getLexer();
if (L.isNot(AsmToken::Comma))
return false;
Lex();
@@ -427,7 +427,7 @@ bool ELFAsmParser::parseMergeSize(int64_t &Size) {
}
bool ELFAsmParser::parseGroup(StringRef &GroupName, bool &IsComdat) {
MCAsmLexer &L = getLexer();
AsmLexer &L = getLexer();
if (L.isNot(AsmToken::Comma))
return TokError("expected group name");
Lex();
@@ -452,7 +452,7 @@ bool ELFAsmParser::parseGroup(StringRef &GroupName, bool &IsComdat) {
}
bool ELFAsmParser::parseLinkedToSym(MCSymbolELF *&LinkedToSym) {
MCAsmLexer &L = getLexer();
AsmLexer &L = getLexer();
if (L.isNot(AsmToken::Comma))
return TokError("expected linked-to symbol");
Lex();
@@ -561,7 +561,7 @@ bool ELFAsmParser::parseSectionArguments(bool IsPush, SMLoc loc) {
if (maybeParseSectionType(TypeName))
return true;
MCAsmLexer &L = getLexer();
AsmLexer &L = getLexer();
if (TypeName.empty()) {
if (Mergeable)
return TokError("Mergeable section must specify the type");

View File

@@ -60,7 +60,7 @@ bool MCAsmParserExtension::parseDirectiveCGProfile(StringRef, SMLoc) {
}
bool MCAsmParserExtension::maybeParseUniqueID(int64_t &UniqueID) {
MCAsmLexer &L = getLexer();
AsmLexer &L = getLexer();
if (L.isNot(AsmToken::Comma))
return false;
Lex();

View File

@@ -35,7 +35,7 @@ namespace {
class WasmAsmParser : public MCAsmParserExtension {
MCAsmParser *Parser = nullptr;
MCAsmLexer *Lexer = nullptr;
AsmLexer *Lexer = nullptr;
template<bool (WasmAsmParser::*HandlerMethod)(StringRef, SMLoc)>
void addDirectiveHandler(StringRef Directive) {

View File

@@ -17,7 +17,7 @@ namespace {
class XCOFFAsmParser : public MCAsmParserExtension {
MCAsmParser *Parser = nullptr;
MCAsmLexer *Lexer = nullptr;
AsmLexer *Lexer = nullptr;
template <bool (XCOFFAsmParser::*HandlerMethod)(StringRef, SMLoc)>
void addDirectiveHandler(StringRef Directive) {

View File

@@ -5523,7 +5523,7 @@ ParseStatus ARMAsmParser::parseRotImm(OperandVector &Operands) {
ParseStatus ARMAsmParser::parseModImm(OperandVector &Operands) {
MCAsmParser &Parser = getParser();
MCAsmLexer &Lexer = getLexer();
AsmLexer &Lexer = getLexer();
int64_t Imm1, Imm2;
SMLoc S = Parser.getTok().getLoc();

View File

@@ -100,7 +100,7 @@ public:
}
MCAsmParser &getParser() const { return Parser; }
MCAsmLexer &getLexer() const { return Parser.getLexer(); }
AsmLexer &getLexer() const { return Parser.getLexer(); }
};
/// An parsed AVR assembly operand.

View File

@@ -106,7 +106,7 @@ class HexagonAsmParser : public MCTargetAsmParser {
return Assembler;
}
MCAsmLexer &getLexer() const { return Parser.getLexer(); }
AsmLexer &getLexer() const { return Parser.getLexer(); }
bool equalIsAsmAssignment() override { return false; }
bool isLabel(AsmToken &Token) override;
@@ -607,7 +607,7 @@ bool HexagonAsmParser::matchOneInstruction(MCInst &MCI, SMLoc IDLoc,
void HexagonAsmParser::eatToEndOfPacket() {
assert(InBrackets);
MCAsmLexer &Lexer = getLexer();
AsmLexer &Lexer = getLexer();
while (!Lexer.is(AsmToken::RCurly))
Lexer.Lex();
Lexer.Lex();
@@ -926,7 +926,7 @@ bool HexagonAsmParser::parseOperand(OperandVector &Operands) {
MCRegister Register;
SMLoc Begin;
SMLoc End;
MCAsmLexer &Lexer = getLexer();
AsmLexer &Lexer = getLexer();
if (!parseRegister(Register, Begin, End)) {
if (!ErrorMissingParenthesis)
switch (Register.id()) {
@@ -981,7 +981,7 @@ bool HexagonAsmParser::parseOperand(OperandVector &Operands) {
}
bool HexagonAsmParser::isLabel(AsmToken &Token) {
MCAsmLexer &Lexer = getLexer();
AsmLexer &Lexer = getLexer();
AsmToken const &Second = Lexer.getTok();
AsmToken Third = Lexer.peekTok();
StringRef String = Token.getString();
@@ -1030,7 +1030,7 @@ bool HexagonAsmParser::parseRegister(MCRegister &Reg, SMLoc &StartLoc,
ParseStatus HexagonAsmParser::tryParseRegister(MCRegister &Reg, SMLoc &StartLoc,
SMLoc &EndLoc) {
MCAsmLexer &Lexer = getLexer();
AsmLexer &Lexer = getLexer();
StartLoc = getLexer().getLoc();
SmallVector<AsmToken, 5> Lookahead;
StringRef RawString(Lexer.getTok().getString().data(), 0);
@@ -1111,7 +1111,7 @@ bool HexagonAsmParser::implicitExpressionLocation(OperandVector &Operands) {
bool HexagonAsmParser::parseExpression(MCExpr const *&Expr) {
SmallVector<AsmToken, 4> Tokens;
MCAsmLexer &Lexer = getLexer();
AsmLexer &Lexer = getLexer();
bool Done = false;
static char const *Comma = ",";
do {
@@ -1161,7 +1161,7 @@ bool HexagonAsmParser::parseExpressionOrOperand(OperandVector &Operands) {
/// Parse an instruction.
bool HexagonAsmParser::parseInstruction(OperandVector &Operands) {
MCAsmParser &Parser = getParser();
MCAsmLexer &Lexer = getLexer();
AsmLexer &Lexer = getLexer();
while (true) {
AsmToken const &Token = Parser.getTok();
switch (Token.getKind()) {

View File

@@ -91,7 +91,7 @@ public:
private:
MCAsmParser &Parser;
MCAsmLexer &Lexer;
AsmLexer &Lexer;
const MCSubtargetInfo &SubtargetInfo;
};

View File

@@ -64,7 +64,7 @@ class MSP430AsmParser : public MCTargetAsmParser {
bool ParseLiteralValues(unsigned Size, SMLoc L);
MCAsmParser &getParser() const { return Parser; }
MCAsmLexer &getLexer() const { return Parser.getLexer(); }
AsmLexer &getLexer() const { return Parser.getLexer(); }
/// @name Auto-generated Matcher Functions
/// {

View File

@@ -8231,7 +8231,7 @@ bool MipsAsmParser::parseSSectionDirective(StringRef Section, unsigned Type) {
/// ::= .module noginv
bool MipsAsmParser::parseDirectiveModule() {
MCAsmParser &Parser = getParser();
MCAsmLexer &Lexer = getLexer();
AsmLexer &Lexer = getLexer();
SMLoc L = Lexer.getLoc();
if (!getTargetStreamer().isModuleDirectiveAllowed()) {
@@ -8472,7 +8472,7 @@ bool MipsAsmParser::parseDirectiveModule() {
/// ::= =64
bool MipsAsmParser::parseDirectiveModuleFP() {
MCAsmParser &Parser = getParser();
MCAsmLexer &Lexer = getLexer();
AsmLexer &Lexer = getLexer();
if (Lexer.isNot(AsmToken::Equal)) {
reportParseError("unexpected token, expected equals sign '='");
@@ -8505,7 +8505,7 @@ bool MipsAsmParser::parseDirectiveModuleFP() {
bool MipsAsmParser::parseFpABIValue(MipsABIFlagsSection::FpABIKind &FpABI,
StringRef Directive) {
MCAsmParser &Parser = getParser();
MCAsmLexer &Lexer = getLexer();
AsmLexer &Lexer = getLexer();
bool ModuleLevelOptions = Directive == ".module";
if (Lexer.is(AsmToken::Identifier)) {

View File

@@ -226,7 +226,7 @@ static MCSymbolWasm *getOrCreateFunctionTableSymbol(MCContext &Ctx,
class WebAssemblyAsmParser final : public MCTargetAsmParser {
MCAsmParser &Parser;
MCAsmLexer &Lexer;
AsmLexer &Lexer;
// Order of labels, directives and instructions in a .s file have no
// syntactical enforcement. This class is a callback from the actual parser,

View File

@@ -1497,7 +1497,7 @@ bool X86AsmParser::MatchRegisterByName(MCRegister &RegNo, StringRef RegName,
bool X86AsmParser::ParseRegister(MCRegister &RegNo, SMLoc &StartLoc,
SMLoc &EndLoc, bool RestoreOnFailure) {
MCAsmParser &Parser = getParser();
MCAsmLexer &Lexer = getLexer();
AsmLexer &Lexer = getLexer();
RegNo = MCRegister();
SmallVector<AsmToken, 5> Tokens;

View File

@@ -47,7 +47,7 @@ Expected<const CodeRegions &> AsmCodeRegionGenerator::parseCodeRegions(
// comments.
std::unique_ptr<MCAsmParser> Parser(
createMCAsmParser(Regions.getSourceMgr(), Ctx, *Str, MAI));
MCAsmLexer &Lexer = Parser->getLexer();
AsmLexer &Lexer = Parser->getLexer();
MCACommentConsumer *CCP = getCommentConsumer();
Lexer.setCommentConsumer(CCP);
// Enable support for MASM literal numbers (example: 05h, 101b).

View File

@@ -100,7 +100,7 @@ protected:
void lexAndCheckTokens(StringRef AsmStr,
SmallVector<AsmToken::TokenKind> ExpectedTokens) {
// Get reference to AsmLexer.
MCAsmLexer &Lexer = Parser->getLexer();
AsmLexer &Lexer = Parser->getLexer();
// Loop through all expected tokens checking one by one.
for (size_t I = 0; I < ExpectedTokens.size(); ++I) {
EXPECT_EQ(Lexer.getTok().getKind(), ExpectedTokens[I]);
@@ -111,7 +111,7 @@ protected:
void lexAndCheckIntegerTokensAndValues(StringRef AsmStr,
SmallVector<int64_t> ExpectedValues) {
// Get reference to AsmLexer.
MCAsmLexer &Lexer = Parser->getLexer();
AsmLexer &Lexer = Parser->getLexer();
// Loop through all expected tokens and expected values.
for (size_t I = 0; I < ExpectedValues.size(); ++I) {
// Skip any EndOfStatement tokens, we're not concerned with them.