[llvm] r205950 - Fix abuse of StringRef on ARM64SysReg::MRSMapper::toString(Val, Valid).

NAKAMURA Takumi geek4civic at gmail.com
Wed Apr 9 20:05:59 PDT 2014


Author: chapuni
Date: Wed Apr  9 22:05:59 2014
New Revision: 205950

URL: http://llvm.org/viewvc/llvm-project?rev=205950&view=rev
Log:
Fix abuse of StringRef on ARM64SysReg::MRSMapper::toString(Val, Valid).

FIXME: Could we use SmallString here?

Modified:
    llvm/trunk/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp

Modified: llvm/trunk/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp?rev=205950&r1=205949&r2=205950&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp Wed Apr  9 22:05:59 2014
@@ -1480,10 +1480,10 @@ void ARM64InstPrinter::printMRSSystemReg
 
   bool Valid;
   auto Mapper = ARM64SysReg::MRSMapper();
-  StringRef Name = Mapper.toString(Val, Valid);
+  std::string Name = Mapper.toString(Val, Valid);
 
   if (Valid)
-    O << StringRef(Name.str()).upper();
+    O << StringRef(Name).upper();
 }
 
 void ARM64InstPrinter::printMSRSystemRegister(const MCInst *MI, unsigned OpNo,
@@ -1492,10 +1492,10 @@ void ARM64InstPrinter::printMSRSystemReg
 
   bool Valid;
   auto Mapper = ARM64SysReg::MSRMapper();
-  StringRef Name = Mapper.toString(Val, Valid);
+  std::string Name = Mapper.toString(Val, Valid);
 
   if (Valid)
-    O << StringRef(Name.str()).upper();
+    O << StringRef(Name).upper();
 }
 
 void ARM64InstPrinter::printSystemCPSRField(const MCInst *MI, unsigned OpNo,





More information about the llvm-commits mailing list