Avoid temporary std::string.

llvm-svn: 197160
This commit is contained in:
Rafael Espindola 2013-12-12 15:48:19 +00:00
parent 4055f42d22
commit 80d333ba22
2 changed files with 5 additions and 6 deletions

View 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);

View 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);