From: Rafael Espindola Date: Thu, 12 Dec 2013 15:48:19 +0000 (+0000) Subject: Avoid temporary std::string. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c22be5d6ab814289b7f6e554aff5f7fb79faa473;p=clang Avoid temporary std::string. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197160 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 99f62fa3c0..d32a422adb 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -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); diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h index c6da145ce3..2ede62e019 100644 --- a/lib/Driver/Tools.h +++ b/lib/Driver/Tools.h @@ -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);