summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-11-02 22:07:47 +0000
committerDan Gohman <gohman@apple.com>2010-11-02 22:07:47 +0000
commit44e24e5403d57a836b1f8ee4f48adaad59763186 (patch)
tree823839428e0e010d4f1bfc3ef490f344a9cc2681 /llvm/lib
parentd2ed5dbf83dd5645ef0ad5ae3a5aa90b16c3a6c2 (diff)
downloadbcm5719-llvm-44e24e5403d57a836b1f8ee4f48adaad59763186.tar.gz
bcm5719-llvm-44e24e5403d57a836b1f8ee4f48adaad59763186.zip
Eliminate some temporary std::strings.
llvm-svn: 118086
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/System/Unix/Path.inc8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc
index 254d4de803f..15588689f92 100644
--- a/llvm/lib/System/Unix/Path.inc
+++ b/llvm/lib/System/Unix/Path.inc
@@ -352,18 +352,18 @@ Path Path::GetMainExecutable(const char *argv0, void *MainAddr) {
if (_NSGetExecutablePath(exe_path, &size) == 0) {
char link_path[MAXPATHLEN];
if (realpath(exe_path, link_path))
- return Path(std::string(link_path));
+ return Path(link_path);
}
#elif defined(__FreeBSD__) || defined (__NetBSD__) || defined(__minix)
char exe_path[PATH_MAX];
if (getprogpath(exe_path, argv0) != NULL)
- return Path(std::string(exe_path));
+ return Path(exe_path);
#elif defined(__linux__) || defined(__CYGWIN__)
char exe_path[MAXPATHLEN];
ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path));
if (len >= 0)
- return Path(std::string(exe_path, len));
+ return Path(StringRef(exe_path, len));
#elif defined(HAVE_DLFCN_H)
// Use dladdr to get executable path if available.
Dl_info DLInfo;
@@ -375,7 +375,7 @@ Path Path::GetMainExecutable(const char *argv0, void *MainAddr) {
// the actual executable.
char link_path[MAXPATHLEN];
if (realpath(DLInfo.dli_fname, link_path))
- return Path(std::string(link_path));
+ return Path(link_path);
#else
#error GetMainExecutable is not implemented on this host yet.
#endif
OpenPOWER on IntegriCloud