From 2c95e5c1c0c66616e4d845b19dae2e0f4d17b1df Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Tue, 5 Jul 2016 23:15:58 +0000 Subject: [PATCH] AArch64: try to fix optimized build failure. I think the Ops filled out by Regex::match contain pointers into the temporary std::string returned by StringRef::upper. Its lifetime is extended by the call to match, but only until the end of that call (not to the uses of Ops later on). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274586 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/AArch64/Utils/AArch64BaseInfo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Target/AArch64/Utils/AArch64BaseInfo.cpp b/lib/Target/AArch64/Utils/AArch64BaseInfo.cpp index 4a7903d26da..e65ba1f2401 100644 --- a/lib/Target/AArch64/Utils/AArch64BaseInfo.cpp +++ b/lib/Target/AArch64/Utils/AArch64BaseInfo.cpp @@ -85,8 +85,9 @@ uint32_t AArch64SysReg::parseGenericRegister(StringRef Name) { // Try to parse an S____ register name Regex GenericRegPattern("^S([0-3])_([0-7])_C([0-9]|1[0-5])_C([0-9]|1[0-5])_([0-7])$"); + std::string UpperName = Name.upper(); SmallVector Ops; - if (!GenericRegPattern.match(Name.upper(), &Ops)) + if (!GenericRegPattern.match(UpperName, &Ops)) return -1; uint32_t Op0 = 0, Op1 = 0, CRn = 0, CRm = 0, Op2 = 0; -- 2.49.0