[llvm] r174328 - Fix some abuses of StringRef
Tim Northover
Tim.Northover at arm.com
Mon Feb 4 07:44:38 PST 2013
Author: tnorthover
Date: Mon Feb 4 09:44:38 2013
New Revision: 174328
URL: http://llvm.org/viewvc/llvm-project?rev=174328&view=rev
Log:
Fix some abuses of StringRef
We were taking a StringRef to a temporary result, which can go horribly wrong.
Modified:
llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
Modified: llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp?rev=174328&r1=174327&r2=174328&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp Mon Feb 4 09:44:38 2013
@@ -1207,8 +1207,8 @@ AArch64AsmParser::ParseRelocPrefix(AArch
return MatchOperand_ParseFail;
}
- StringRef lowerCase = Parser.getTok().getIdentifier().lower();
- RefKind = StringSwitch<AArch64MCExpr::VariantKind>(lowerCase)
+ std::string LowerCase = Parser.getTok().getIdentifier().lower();
+ RefKind = StringSwitch<AArch64MCExpr::VariantKind>(LowerCase)
.Case("got", AArch64MCExpr::VK_AARCH64_GOT)
.Case("got_lo12", AArch64MCExpr::VK_AARCH64_GOT_LO12)
.Case("lo12", AArch64MCExpr::VK_AARCH64_LO12)
@@ -1343,7 +1343,8 @@ AArch64AsmParser::ParseCRxOperand(
return MatchOperand_ParseFail;
}
- StringRef Tok = Parser.getTok().getIdentifier().lower();
+ std::string LowerTok = Parser.getTok().getIdentifier().lower();
+ StringRef Tok(LowerTok);
if (Tok[0] != 'c') {
Error(S, "Expected cN operand where 0 <= N <= 15");
return MatchOperand_ParseFail;
More information about the llvm-commits
mailing list