[llvm-commits] [llvm] r106724 - /llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp
Chris Lattner
sabre at nondot.org
Thu Jun 24 00:18:14 PDT 2010
Author: lattner
Date: Thu Jun 24 02:18:14 2010
New Revision: 106724
URL: http://llvm.org/viewvc/llvm-project?rev=106724&view=rev
Log:
more cleanups
Modified:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp?rev=106724&r1=106723&r2=106724&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp Thu Jun 24 02:18:14 2010
@@ -33,13 +33,11 @@
}
const AsmToken &lexDefinite() {
- if(tentativeIsValid) {
+ if (tentativeIsValid) {
tentativeIsValid = false;
return tentativeToken;
}
- else {
- return getLexer()->Lex();
- }
+ return getLexer()->Lex();
}
AsmToken LexTokenATT();
@@ -72,18 +70,19 @@
static unsigned MatchRegisterName(StringRef Name);
AsmToken X86AsmLexer::LexTokenATT() {
- const AsmToken lexedToken = lexDefinite();
+ AsmToken lexedToken = lexDefinite();
switch (lexedToken.getKind()) {
default:
- return AsmToken(lexedToken);
+ return lexedToken;
case AsmToken::Error:
SetError(Lexer->getErrLoc(), Lexer->getErr());
- return AsmToken(lexedToken);
- case AsmToken::Percent: {
+ return lexedToken;
+
+ case AsmToken::Percent: {
const AsmToken &nextToken = lexTentative();
if (nextToken.getKind() != AsmToken::Identifier)
- return AsmToken(lexedToken);
+ return lexedToken;
if (unsigned regID = MatchRegisterName(nextToken.getString())) {
@@ -93,12 +92,11 @@
lexedToken.getString().size() +
nextToken.getString().size());
- return AsmToken(AsmToken::Register,
- regStr,
+ return AsmToken(AsmToken::Register, regStr,
static_cast<int64_t>(regID));
}
- return AsmToken(lexedToken);
+ return lexedToken;
}
}
}
@@ -108,26 +106,22 @@
switch(lexedToken.getKind()) {
default:
- return AsmToken(lexedToken);
+ return lexedToken;
case AsmToken::Error:
SetError(Lexer->getErrLoc(), Lexer->getErr());
- return AsmToken(lexedToken);
- case AsmToken::Identifier:
- {
+ return lexedToken;
+ case AsmToken::Identifier: {
std::string upperCase = lexedToken.getString().str();
std::string lowerCase = LowercaseString(upperCase);
StringRef lowerRef(lowerCase);
unsigned regID = MatchRegisterName(lowerRef);
- if (regID) {
+ if (regID)
return AsmToken(AsmToken::Register,
lexedToken.getString(),
static_cast<int64_t>(regID));
- }
- else {
- return AsmToken(lexedToken);
- }
+ return lexedToken;
}
}
}
More information about the llvm-commits
mailing list