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
// Try to parse an S<op0>_<op1>_<Cn>_<Cm>_<op2> 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<StringRef, 5> 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;