]> granicus.if.org Git - clang/commitdiff
Avoid temporary std::string.
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 12 Dec 2013 15:48:19 +0000 (15:48 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 12 Dec 2013 15:48:19 +0000 (15:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197160 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
lib/Driver/Tools.h

index 99f62fa3c0be82c420d897c3d9cfae11e57d2227..d32a422adb23ccbbd991c3e1852015ee4ea99942 100644 (file)
@@ -4532,10 +4532,9 @@ const char *arm::getARMCPUForMArch(const ArgList &Args,
       : "arm7tdmi";
 }
 
-/// FIXME: this should return a stringref once getHostCPUName return one.
 /// getARMTargetCPU - Get the (LLVM) name of the ARM cpu we are targeting.
-std::string arm::getARMTargetCPU(const ArgList &Args,
-                                 const llvm::Triple &Triple) {
+StringRef arm::getARMTargetCPU(const ArgList &Args,
+                               const llvm::Triple &Triple) {
   // FIXME: Warn on inconsistent use of -mcpu and -march.
   // If we have -mcpu=, use that.
   if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
@@ -4544,7 +4543,7 @@ std::string arm::getARMTargetCPU(const ArgList &Args,
     if (MCPU == "native")
       return llvm::sys::getHostCPUName();
     else
-      return MCPU.str();
+      return MCPU;
   }
 
   return getARMCPUForMArch(Args, Triple);
index c6da145ce3750e7f4b3b5f7154e4f3a49b651b93..2ede62e019bc9963e86563a9a1bb5366896ecfd0 100644 (file)
@@ -202,8 +202,8 @@ namespace hexagon {
 } // end namespace hexagon.
 
 namespace arm {
-  std::string getARMTargetCPU(const llvm::opt::ArgList &Args,
-                              const llvm::Triple &Triple);
+  StringRef getARMTargetCPU(const llvm::opt::ArgList &Args,
+                            const llvm::Triple &Triple);
   const char* getARMCPUForMArch(const llvm::opt::ArgList &Args,
                                 const llvm::Triple &Triple);
   const char* getLLVMArchSuffixForARM(StringRef CPU);