[ARM64] Fix a heap-use-after-free spotted by ASan.
authorChandler Carruth <chandlerc@gmail.com>
Sun, 30 Mar 2014 09:08:07 +0000 (09:08 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 30 Mar 2014 09:08:07 +0000 (09:08 +0000)
StringRef::lower() returns a std::string. Better yet, we can now stop
thinking about what it returns and write 'auto'. It does the right
thing. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205135 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp

index e72189e766a0244ff59e93322adf7b07abbd773e..705d192356e029ef36991219c6a1fbf80209ef41 100644 (file)
@@ -2653,7 +2653,7 @@ ARM64AsmParser::tryParseSystemRegister(OperandVector &Operands) {
   if (Tok.isNot(AsmToken::Identifier))
     return MatchOperand_NoMatch;
 
-  StringRef ID = Tok.getString().lower();
+  auto ID = Tok.getString().lower();
   ARM64SYS::SystemRegister Reg =
       StringSwitch<ARM64SYS::SystemRegister>(ID)
           .Case("spsr_el1", ARM64SYS::SPSR_svc)