[llvm] r358036 - [X86] Fix a dangling StringRef issue introduced in r358029.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 9 14:37:21 PDT 2019
Author: ctopper
Date: Tue Apr 9 14:37:21 2019
New Revision: 358036
URL: http://llvm.org/viewvc/llvm-project?rev=358036&view=rev
Log:
[X86] Fix a dangling StringRef issue introduced in r358029.
I was attempting to convert mnemonics to lower case after processing a pseudo prefix. But the ParseOperands just hold a StringRef for tokens so there is no where to allocate the memory.
Add FIXMEs for the lower case issue which also exists in the prefix parsing code.
Modified:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=358036&r1=358035&r2=358036&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Apr 9 14:37:21 2019
@@ -2310,7 +2310,6 @@ bool X86AsmParser::ParseInstruction(Pars
SMLoc NameLoc, OperandVector &Operands) {
MCAsmParser &Parser = getParser();
InstInfo = &Info;
- std::string TempName; // Used when we parse a pseudo prefix.
// Reset the forced VEX encoding.
ForcedVEXEncoding = VEXEncoding_Default;
@@ -2342,8 +2341,8 @@ bool X86AsmParser::ParseInstruction(Pars
} else {
if (getLexer().isNot(AsmToken::Identifier))
return Error(Parser.getTok().getLoc(), "Expected identifier");
- TempName = Parser.getTok().getString().lower();
- Name = TempName;
+ // FIXME: The mnemonic won't match correctly if its not in lower case.
+ Name = Parser.getTok().getString();
Parser.Lex();
}
continue;
@@ -2545,6 +2544,7 @@ bool X86AsmParser::ParseInstruction(Pars
Flags = X86::IP_NO_PREFIX;
break;
}
+ // FIXME: The mnemonic won't match correctly if its not in lower case.
Name = Parser.getTok().getString();
Parser.Lex(); // eat the prefix
// Hack: we could have something like "rep # some comment" or
@@ -2552,6 +2552,7 @@ bool X86AsmParser::ParseInstruction(Pars
while (Name.startswith(";") || Name.startswith("\n") ||
Name.startswith("#") || Name.startswith("\t") ||
Name.startswith("/")) {
+ // FIXME: The mnemonic won't match correctly if its not in lower case.
Name = Parser.getTok().getString();
Parser.Lex(); // go to next prefix or instr
}
More information about the llvm-commits
mailing list