aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/llvm-mc/AsmLexer.h4
-rw-r--r--tools/llvm-mc/AsmParser.cpp4
-rw-r--r--tools/llvm-mc/llvm-mc.cpp7
3 files changed, 6 insertions, 9 deletions
diff --git a/tools/llvm-mc/AsmLexer.h b/tools/llvm-mc/AsmLexer.h
index 3bedc6e..2918e43 100644
--- a/tools/llvm-mc/AsmLexer.h
+++ b/tools/llvm-mc/AsmLexer.h
@@ -110,8 +110,8 @@ public:
AsmLexer(SourceMgr &SrcMgr);
~AsmLexer();
- AsmToken::TokenKind Lex() {
- return CurTok = LexToken(), getKind();
+ const AsmToken &Lex() {
+ return CurTok = LexToken();
}
AsmToken::TokenKind getKind() const { return CurTok.getKind(); }
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index 602d696..e4c85a7 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -318,7 +318,7 @@ bool AsmParser::ParseStatement() {
StringRef IDVal = ID.getString();
// Consume the identifier, see what is after it.
- switch (Lexer.Lex()) {
+ switch (Lexer.Lex().getKind()) {
case AsmToken::Colon: {
// identifier ':' -> Label.
Lexer.Lex();
@@ -609,7 +609,7 @@ bool AsmParser::ParseDirectiveSet() {
StringRef Name = Lexer.getTok().getString();
- if (Lexer.Lex() != AsmToken::Comma)
+ if (Lexer.Lex().isNot(AsmToken::Comma))
return TokError("unexpected token in '.set'");
Lexer.Lex();
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index 63cb70d..a64c8a6 100644
--- a/tools/llvm-mc/llvm-mc.cpp
+++ b/tools/llvm-mc/llvm-mc.cpp
@@ -83,9 +83,8 @@ static int AsLexInput(const char *ProgName) {
bool Error = false;
- AsmToken::TokenKind Tok = Lexer.Lex();
- while (Tok != AsmToken::Eof) {
- switch (Tok) {
+ while (Lexer.Lex().isNot(AsmToken::Eof)) {
+ switch (Lexer.getKind()) {
default:
Lexer.PrintMessage(Lexer.getLoc(), "unknown token", "warning");
Error = true;
@@ -136,8 +135,6 @@ static int AsLexInput(const char *ProgName) {
case AsmToken::Star: outs() << "Star\n"; break;
case AsmToken::Tilde: outs() << "Tilde\n"; break;
}
-
- Tok = Lexer.Lex();
}
return Error;