diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-12-12 15:39:05 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-12-12 15:39:05 +0000 |
commit | 9c5ef12d669994e5f5a3cc1ef1be7aa2a95f4ed1 (patch) | |
tree | 675ff5379dfd0b0038624db89062d169acc8a350 /clang/lib | |
parent | 86d8fb5ba12f5f2eeadb53b32f6763617dbdf8de (diff) | |
download | bcm5719-llvm-9c5ef12d669994e5f5a3cc1ef1be7aa2a95f4ed1.tar.gz bcm5719-llvm-9c5ef12d669994e5f5a3cc1ef1be7aa2a95f4ed1.zip |
Don't return a pointer to a temporary std::string's c_str.
llvm-svn: 197157
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 7 | ||||
-rw-r--r-- | clang/lib/Driver/Tools.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 74cd3937752..99f62fa3c0b 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -4532,8 +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. -const char *arm::getARMTargetCPU(const ArgList &Args, +std::string arm::getARMTargetCPU(const ArgList &Args, const llvm::Triple &Triple) { // FIXME: Warn on inconsistent use of -mcpu and -march. // If we have -mcpu=, use that. @@ -4541,9 +4542,9 @@ const char *arm::getARMTargetCPU(const ArgList &Args, StringRef MCPU = A->getValue(); // Handle -mcpu=native. if (MCPU == "native") - return llvm::sys::getHostCPUName().c_str(); + return llvm::sys::getHostCPUName(); else - return MCPU.str().c_str(); + return MCPU.str(); } return getARMCPUForMArch(Args, Triple); diff --git a/clang/lib/Driver/Tools.h b/clang/lib/Driver/Tools.h index 562352f035c..c6da145ce37 100644 --- a/clang/lib/Driver/Tools.h +++ b/clang/lib/Driver/Tools.h @@ -202,7 +202,7 @@ namespace hexagon { } // end namespace hexagon. namespace arm { - const char* getARMTargetCPU(const llvm::opt::ArgList &Args, + std::string getARMTargetCPU(const llvm::opt::ArgList &Args, const llvm::Triple &Triple); const char* getARMCPUForMArch(const llvm::opt::ArgList &Args, const llvm::Triple &Triple); |