[llvm-commits] [llvm] r77328 - in /llvm/trunk/tools/llvm-mc: AsmLexer.h AsmParser.cpp llvm-mc.cpp
Daniel Dunbar
daniel at zuster.org
Tue Jul 28 09:56:45 PDT 2009
Author: ddunbar
Date: Tue Jul 28 11:56:42 2009
New Revision: 77328
URL: http://llvm.org/viewvc/llvm-project?rev=77328&view=rev
Log:
Switch AsmLexer::Lex to returning a reference to the current token.
Modified:
llvm/trunk/tools/llvm-mc/AsmLexer.h
llvm/trunk/tools/llvm-mc/AsmParser.cpp
llvm/trunk/tools/llvm-mc/llvm-mc.cpp
Modified: llvm/trunk/tools/llvm-mc/AsmLexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmLexer.h?rev=77328&r1=77327&r2=77328&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmLexer.h (original)
+++ llvm/trunk/tools/llvm-mc/AsmLexer.h Tue Jul 28 11:56:42 2009
@@ -110,8 +110,8 @@
AsmLexer(SourceMgr &SrcMgr);
~AsmLexer();
- AsmToken::TokenKind Lex() {
- return CurTok = LexToken(), getKind();
+ const AsmToken &Lex() {
+ return CurTok = LexToken();
}
AsmToken::TokenKind getKind() const { return CurTok.getKind(); }
Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=77328&r1=77327&r2=77328&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Tue Jul 28 11:56:42 2009
@@ -318,7 +318,7 @@
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 @@
StringRef Name = Lexer.getTok().getString();
- if (Lexer.Lex() != AsmToken::Comma)
+ if (Lexer.Lex().isNot(AsmToken::Comma))
return TokError("unexpected token in '.set'");
Lexer.Lex();
Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=77328&r1=77327&r2=77328&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
+++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Tue Jul 28 11:56:42 2009
@@ -83,9 +83,8 @@
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 @@
case AsmToken::Star: outs() << "Star\n"; break;
case AsmToken::Tilde: outs() << "Tilde\n"; break;
}
-
- Tok = Lexer.Lex();
}
return Error;
More information about the llvm-commits
mailing list