do not use strcasecmp() but StringRef.lower() for string comparison

This commit is contained in:
Nguyen Anh Quynh
2016-05-11 01:13:19 +08:00
parent e3f7fa6f55
commit 48d30fa01c
2 changed files with 3 additions and 11 deletions
+1 -5
View File
@@ -1361,10 +1361,6 @@ bool AsmParser::isDirective(StringRef IDVal)
return (IDVal[0] == '.' && IDVal != ".");
}
#if defined(_WIN32) || defined(_WIN64)
#define strcasecmp _stricmp
#endif
/// ParseStatement:
/// ::= EndOfStatement
/// ::= Label* Directive ...Operands... EndOfStatement
@@ -1425,7 +1421,7 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
// [bits xx]
Lex();
ID = Lexer.getTok();
if (strcasecmp(ID.getString().str().c_str(), "bits") == 0) {
if (ID.getString().lower() == "bits") {
Lex();
if (parseDirectiveBits()) {
Info.KsError = KS_ERR_ASM_DIRECTIVE_ID;
@@ -1273,10 +1273,6 @@ RewriteIntelBracExpression(SmallVectorImpl<AsmRewrite> &AsmRewrites,
}
}
#if defined(_WIN32) || defined(_WIN64)
#define strcasecmp _stricmp
#endif
bool X86AsmParser::ParseIntelExpression(IntelExprStateMachine &SM, SMLoc &End)
{
unsigned int ErrorCode;
@@ -1836,11 +1832,11 @@ std::unique_ptr<X86Operand> X86AsmParser::ParseIntelOperand(StringRef Mnem)
Parser.Lex(); // Eat operand size (e.g., byte, word).
if (KsSyntax == KS_OPT_SYNTAX_NASM) {
// Nasm do not accept 'PTR' in memory operands
if (strcasecmp(Tok.getString().str().c_str(), "ptr") == 0)
if (Tok.getString().lower() == "ptr")
return ErrorOperand(Tok.getLoc(), "Do not expected 'PTR' or 'ptr' token!");
} else {
// LLVM requires 'PTR' in memory operand
if (strcasecmp(Tok.getString().str().c_str(), "ptr") != 0)
if (Tok.getString().lower() != "ptr")
return ErrorOperand(Tok.getLoc(), "Expected 'PTR' or 'ptr' token!");
Parser.Lex(); // Eat ptr.
}